Aireed commented on code in PR #3717:
URL: https://github.com/apache/amoro/pull/3717#discussion_r2261786799


##########
amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/catalog/FlinkUnifiedCatalog.java:
##########
@@ -169,22 +173,43 @@ public List<String> listViews(String databaseName) {
   @Override
   public CatalogBaseTable getTable(ObjectPath tablePath)
       throws TableNotExistException, CatalogException {
-    AmoroTable<?> amoroTable;
-    try {
-      amoroTable = unifiedCatalog.loadTable(tablePath.getDatabaseName(), 
tablePath.getObjectName());
-    } catch (NoSuchTableException e) {
-      throw new TableNotExistException(getName(), tablePath, e);
-    }
-    AbstractCatalog catalog = originalCatalog(amoroTable);
-    CatalogTable catalogTable = (CatalogTable) catalog.getTable(tablePath);
-    final Map<String, String> flinkProperties = 
Maps.newHashMap(catalogTable.getOptions());
-    flinkProperties.put(TABLE_FORMAT.key(), amoroTable.format().toString());
-
-    return CatalogTable.of(
-        catalogTable.getUnresolvedSchema(),
-        catalogTable.getComment(),
-        catalogTable.getPartitionKeys(),
-        flinkProperties);
+    TableIdentifier tableIdentifier =
+        TableIdentifier.of(
+            this.amoroCatalogName, tablePath.getDatabaseName(), 
tablePath.getObjectName());
+    Set<TableFormat> formats =
+        CatalogUtil.tableFormats(unifiedCatalog.metastoreType(), 
unifiedCatalog.properties());
+
+    TableMetaStore tableMetaStore = unifiedCatalog.authenticationContext();
+    return formats.stream()
+        .map(
+            f -> {
+              try {
+                AbstractCatalog catalog =
+                    getOriginalCatalog(f)
+                        .orElseGet(() -> 
createOriginalCatalog(tableIdentifier, f));
+                CatalogTable catalogTable =
+                    (CatalogTable) tableMetaStore.doAs(() -> 
catalog.getTable(tablePath));

Review Comment:
   why we need doAs here?



-- 
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