mchades commented on code in PR #4942:
URL: https://github.com/apache/gravitino/pull/4942#discussion_r1776753445


##########
catalogs/catalog-lakehouse-hudi/src/main/java/org/apache/gravitino/catalog/lakehouse/hudi/backend/hms/HudiHMSTable.java:
##########
@@ -44,15 +49,24 @@ protected HudiHMSTable simpleBuild() {
       table.columns = columns;
       table.indexes = indexes;
       table.partitioning = partitioning;
+      table.sortOrders = sortOrders;
       table.distribution = distribution;
       table.properties = properties;
       table.auditInfo = auditInfo;
       return table;
     }
 
     @Override
-    protected HudiTable buildFromTable(Table backendTable) {
-      // todo: convert HMS table to HudiTable
+    protected HudiHMSTable buildFromTable(Table hmsTable) {
+      name = hmsTable.getTableName();
+      comment = hmsTable.getParameters().get(COMMENT);
+      columns = HiveTableConverter.getColumns(hmsTable, HudiColumn.builder());
+      partitioning = HiveTableConverter.getPartitioning(hmsTable);
+      sortOrders = HiveTableConverter.getSortOrders(hmsTable);
+      distribution = HiveTableConverter.getDistribution(hmsTable);

Review Comment:
   comments added to the code



##########
catalogs/catalog-lakehouse-hudi/src/main/java/org/apache/gravitino/catalog/lakehouse/hudi/backend/hms/HudiHMSBackendOps.java:
##########
@@ -73,12 +125,51 @@ public boolean dropSchema(NameIdentifier ident, boolean 
cascade) throws NonEmpty
 
   @Override
   public NameIdentifier[] listTables(Namespace namespace) throws 
NoSuchSchemaException {
-    throw new UnsupportedOperationException("Not implemented yet");
+    NameIdentifier schemaIdent = NameIdentifier.of(namespace.levels());
+    if (!schemaExists(schemaIdent)) {
+      throw new NoSuchSchemaException("Schema (database) does not exist %s", 
namespace);
+    }
+
+    try {
+      return clientPool.run(
+          c ->
+              c.getTables(schemaIdent.name(), "*").stream()
+                  .map(table -> NameIdentifier.of(namespace, table))
+                  .toArray(NameIdentifier[]::new));

Review Comment:
   fixed



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