Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support Flink catalog #295

Merged
merged 3 commits into from
Oct 30, 2023
Merged

[Feature] Support Flink catalog #295

merged 3 commits into from
Oct 30, 2023

Conversation

banmoy
Copy link
Collaborator

@banmoy banmoy commented Oct 23, 2023

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Which issues of this PR fixes :

Fixes #

Problem Summary(Required) :

Support Flink catalog to ease the usage of the connector. The connector will fetch the metadata, such as schema, via the catalog, and users don't need to declare the table structure explicitly in Flink SQL. The catalog for StarRocks supports the following methods, and other methods are currently not supported.

listDatabases();
getDatabase(String databaseName);
databaseExists(String databaseName);
createDatabase(String databaseName, CatalogDatabase database, boolean ignoreIfExists);
listTables(String databaseName);
tableExists(ObjectPath tablePath);
getTable(ObjectPath tablePath);
createTable(ObjectPath tablePath, CatalogBaseTable table, boolean ignoreIfExists);
dropTable(ObjectPath tablePath, boolean ignoreIfNotExists);

An example to access StarRocks table with the catalog in Flink SQL

CREATE CATALOG `sr_catalog` WITH(
    'type' = 'starrocks',
    # FE jdbc server
    'jdbc-url' = 'xxx',
    # FE http server
    'http-url' = 'xxx',
    'username' = 'xxx',
    'password' = 'xxx',
    'default-database' = 'xxx'
);
USE CATALOG `sr_catalog`;

# write data to the StarRocks table `test`.`score_board`. The catalog will
# fetch the metadata of the table from StarRocks, and need to declare a
# create table statement like before
INSERT INTO `test`.`score_board` VALUES (1, 'starrocks', 100);

# read data from the StarRocks table `test`.`score_board`. The catalog will
# fetch the metadata of the table from StarRocks, and need to declare a
# create table statement like before
SELECT * FROM `test`.`score_board`;

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr will affect users' behaviors
  • This pr needs user documentation (for new or modified features or behaviors)
  • I have added documentation for my new feature or new function

Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
@banmoy banmoy mentioned this pull request Oct 23, 2023
@banmoy banmoy self-assigned this Oct 26, 2023
@banmoy banmoy merged commit f55a5b8 into StarRocks:main Oct 30, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants