FANNG1 commented on code in PR #9689:
URL: https://github.com/apache/gravitino/pull/9689#discussion_r2752415307


##########
flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/hive/GravitinoHiveCatalog.java:
##########
@@ -67,4 +92,155 @@ public Optional<Factory> getFactory() {
   protected AbstractCatalog realCatalog() {
     return hiveCatalog;
   }
+
+  @Override
+  public void createTable(ObjectPath tablePath, CatalogBaseTable table, 
boolean ignoreIfExists)
+      throws TableAlreadyExistException, DatabaseNotExistException, 
CatalogException {
+    Preconditions.checkArgument(
+        table instanceof ResolvedCatalogBaseTable, "table should be resolved");
+
+    if (!FlinkGenericTableUtil.isGenericTableWhenCreate(table.getOptions())) {
+      super.createTable(tablePath, table, ignoreIfExists);
+      return;
+    }
+
+    if (!(table instanceof ResolvedCatalogTable)) {
+      throw new CatalogException("Generic table must be a resolved catalog 
table");
+    }
+    ResolvedCatalogTable resolvedTable = (ResolvedCatalogTable) table;
+
+    NameIdentifier identifier =
+        NameIdentifier.of(tablePath.getDatabaseName(), 
tablePath.getObjectName());
+    Map<String, String> properties =
+        FlinkGenericTableUtil.toGravitinoGenericTableProperties(resolvedTable);
+
+    try {
+      catalog()
+          .asTableCatalog()
+          .createTable(
+              identifier,
+              new Column[0],
+              table.getComment(),
+              properties,
+              new Transform[0],
+              Distributions.NONE,
+              new SortOrder[0],
+              new Index[0]);

Review Comment:
   add integration test to cover 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