-
Notifications
You must be signed in to change notification settings - Fork 771
[#10541] refactor(flink-connector): split versioned framework with Flink 1.18 baseline #10517
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
base: main
Are you sure you want to change the base?
Changes from all commits
3ef82d0
b68f1e9
978cac0
c580154
063ba51
c179a64
23c5c76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ | |
| import org.apache.flink.table.catalog.AbstractCatalog; | ||
| import org.apache.flink.table.catalog.CatalogBaseTable; | ||
| import org.apache.flink.table.catalog.CatalogPropertiesUtil; | ||
| import org.apache.flink.table.catalog.CatalogTable; | ||
| import org.apache.flink.table.catalog.ObjectPath; | ||
| import org.apache.flink.table.catalog.ResolvedCatalogBaseTable; | ||
| import org.apache.flink.table.catalog.ResolvedCatalogTable; | ||
|
|
@@ -111,8 +112,7 @@ public void createTable(ObjectPath tablePath, CatalogBaseTable table, boolean ig | |
|
|
||
| NameIdentifier identifier = | ||
| NameIdentifier.of(tablePath.getDatabaseName(), tablePath.getObjectName()); | ||
| Map<String, String> properties = | ||
| FlinkGenericTableUtil.toGravitinoGenericTableProperties(resolvedTable); | ||
| Map<String, String> properties = toGravitinoGenericTableProperties(resolvedTable); | ||
|
|
||
| try { | ||
| catalog() | ||
|
|
@@ -146,7 +146,7 @@ public CatalogBaseTable getTable(ObjectPath tablePath) | |
| .asTableCatalog() | ||
| .loadTable(NameIdentifier.of(tablePath.getDatabaseName(), tablePath.getObjectName())); | ||
| if (FlinkGenericTableUtil.isGenericTableWhenLoad(table.properties())) { | ||
| return FlinkGenericTableUtil.toFlinkGenericTable(table); | ||
| return toFlinkGenericTable(table); | ||
| } | ||
| return super.toFlinkTable(table, tablePath); | ||
| } catch (NoSuchTableException e) { | ||
|
|
@@ -218,8 +218,7 @@ private void applyGenericTableAlter( | |
| throws TableNotExistException, CatalogException { | ||
| NameIdentifier identifier = | ||
| NameIdentifier.of(tablePath.getDatabaseName(), tablePath.getObjectName()); | ||
| Map<String, String> updatedProperties = | ||
| FlinkGenericTableUtil.toGravitinoGenericTableProperties(newTable); | ||
| Map<String, String> updatedProperties = toGravitinoGenericTableProperties(newTable); | ||
| Map<String, String> currentProperties = | ||
| existingTable.properties() == null ? Collections.emptyMap() : existingTable.properties(); | ||
|
|
||
|
|
@@ -252,4 +251,13 @@ private void applyGenericTableAlter( | |
| throw new CatalogException(e); | ||
| } | ||
| } | ||
|
|
||
| protected Map<String, String> toGravitinoGenericTableProperties( | ||
| ResolvedCatalogTable resolvedTable) { | ||
| return FlinkGenericTableUtil.toGravitinoGenericTableProperties(resolvedTable, catalogCompat()); | ||
| } | ||
|
|
||
| protected CatalogTable toFlinkGenericTable(Table table) { | ||
| return FlinkGenericTableUtil.toFlinkGenericTable(table, catalogCompat()); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we move these methods back to the Util class?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to keep these thin wrapper methods on the catalog class. They delegate to |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have any other oss project compatible with multiple versions,Is it implemented in the same way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think this needs a code change in this PR. The current structure uses a shared common layer plus version-specific adapters/hooks (
catalogCompat()and the versioned catalog/factory classes) to isolate Flink minor-version API differences. That is the main reason for this split: keep the common behavior in one place and localize the Flink-version-specific parts in each version module.