JingsongLi commented on code in PR #8001:
URL: https://github.com/apache/paimon/pull/8001#discussion_r3464869648


##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/lineage/LineageUtils.java:
##########
@@ -122,6 +136,25 @@ public static String getNamespace(Table table, @Nullable 
CatalogContext catalogC
         return DEFAULT_NAMESPACE;
     }
 
+    @VisibleForTesting
+    static String resolveNameByMetastore(Table table, @Nullable String 
defaultName) {
+        CatalogContext ctx = catalogContext(table);
+        if (ctx != null) {
+            Options catalogOptions = ctx.options();
+            // If jdbc metastore is used, use catalog-key as the catalog 
identifier.
+            if (JdbcCatalogFactory.IDENTIFIER.equals(
+                    catalogOptions.get(CatalogOptions.METASTORE))) {
+                String catalogKeyValue = 
catalogOptions.get(JdbcCatalogOptions.CATALOG_KEY);
+                if (!StringUtils.isNullOrWhitespaceOnly(catalogKeyValue)) {
+                    return catalogKeyValue + "." + table.fullName();

Review Comment:
   This also changes the existing table/SQL lineage path. 
`PaimonDataStreamScanProvider` and `PaimonDataStreamSinkProvider` pass the 
Flink `tableIdentifier.asSummaryString()` as an explicit name, but for JDBC 
catalogs this branch ignores it and emits `catalog-key + "." + 
table.fullName()` instead, while non-JDBC catalogs keep the Flink identifier. 
That makes table/SQL dataset names metastore-dependent even though the new 
derivation is only needed when the non-table DataStream APIs do not have a 
name. Please keep `defaultName` when it is non-null, and only derive the 
catalog-key name when no explicit name was provided; a JDBC-metastore 
regression for the explicit-name overload would catch this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to