pvary commented on code in PR #12199:
URL: https://github.com/apache/iceberg/pull/12199#discussion_r1947502501


##########
flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java:
##########
@@ -332,7 +335,15 @@ public List<String> listTables(String databaseName)
   public CatalogTable getTable(ObjectPath tablePath)
       throws TableNotExistException, CatalogException {
     Table table = loadIcebergTable(tablePath);
-    return toCatalogTable(table);
+    Map<String, String> catalogAndTableProps = Maps.newHashMap(catalogProps);
+    catalogAndTableProps.put(FlinkCreateTableOptions.CATALOG_NAME.key(), 
getName());
+    catalogAndTableProps.put(
+        FlinkCreateTableOptions.CATALOG_DATABASE.key(), 
tablePath.getDatabaseName());
+    catalogAndTableProps.put(
+        FlinkCreateTableOptions.CATALOG_TABLE.key(), 
tablePath.getObjectName());
+    catalogAndTableProps.put("connector", 
FlinkDynamicTableFactory.FACTORY_IDENTIFIER);
+    catalogAndTableProps.putAll(table.properties());
+    return toCatalogTableWithProps(table, catalogAndTableProps);

Review Comment:
   Just thinking out loud:
   - Maybe the code would be easier to read if we send only the catalogProps to 
the `toCatalogTableWithProps` and create a merged map when calling the Flink 
method
   - This is somewhat suboptimal as we create an extra map
   
   Even if we decide to follow your approach, the parameter name of the method 
should reflect that at the declaration of `toCatalogTableWithProps`, and maybe 
some comments or javadoc should be nice there for future generations 😉 
   
   WDYT?



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to