Aitozi commented on code in PR #21522:
URL: https://github.com/apache/flink/pull/21522#discussion_r1134212972


##########
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java:
##########
@@ -473,27 +476,37 @@ public void createTable(ObjectPath tablePath, 
CatalogBaseTable table, boolean ig
             throws TableAlreadyExistException, DatabaseNotExistException, 
CatalogException {
         checkNotNull(tablePath, "tablePath cannot be null");
         checkNotNull(table, "table cannot be null");
+        checkArgument(
+                table instanceof ResolvedCatalogBaseTable,
+                "target catalog table should be resolved");
 
+        ResolvedCatalogBaseTable resolvedTable = (ResolvedCatalogBaseTable) 
table;
         if (!databaseExists(tablePath.getDatabaseName())) {
             throw new DatabaseNotExistException(getName(), 
tablePath.getDatabaseName());
         }
 
-        boolean managedTable = ManagedTableListener.isManagedTable(this, 
table);
+        boolean managedTable = ManagedTableListener.isManagedTable(this, 
resolvedTable);
         Table hiveTable =
-                HiveTableUtil.instantiateHiveTable(tablePath, table, hiveConf, 
managedTable);
+                HiveTableUtil.instantiateHiveTable(
+                        tablePath, resolvedTable, hiveConf, managedTable);
 
         UniqueConstraint pkConstraint = null;
+        ResolvedSchema resolvedSchema = resolvedTable.getResolvedSchema();
         List<String> notNullCols = new ArrayList<>();
-        boolean isHiveTable = isHiveTable(table.getOptions());
+        boolean isHiveTable = isHiveTable(resolvedTable.getOptions());
         if (isHiveTable) {
-            pkConstraint = table.getSchema().getPrimaryKey().orElse(null);
+            // TODO replace the deprecated UniqueConstraint

Review Comment:
   https://issues.apache.org/jira/browse/FLINK-31426



-- 
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...@flink.apache.org

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

Reply via email to