luoyuxia commented on code in PR #1508:
URL: https://github.com/apache/fluss/pull/1508#discussion_r2268770153


##########
fluss-lake/fluss-lake-iceberg/src/main/java/com/alibaba/fluss/lake/iceberg/IcebergLakeCatalog.java:
##########
@@ -204,21 +208,47 @@ private PartitionSpec createPartitionSpec(
                                         new IllegalArgumentException(
                                                 "Bucket count (bucket.num) 
must be set"));
 
-        if (bucketKeys.isEmpty()) {
-            throw new IllegalArgumentException(
-                    "Bucket key must be set for primary key Iceberg tables");
-        }
+        // Only support one bucket key for now
         if (bucketKeys.size() > 1) {
             throw new UnsupportedOperationException(
                     "Only one bucket key is supported for Iceberg at the 
moment");
         }
 
+        // pk table must have bucket key
+        if (bucketKeys.isEmpty() && isPkTable) {
+            throw new IllegalArgumentException(
+                    "Bucket key must be set for primary key Iceberg tables");
+        }
+
+        // bucket key must exist in schema

Review Comment:
   We can remove this check since it already been checked before call method 
`IcebergLakeCatalog#createTable`



##########
fluss-lake/fluss-lake-iceberg/src/main/java/com/alibaba/fluss/lake/iceberg/IcebergLakeCatalog.java:
##########
@@ -145,10 +143,11 @@ private void createTable(TablePath tablePath, 
Catalog.TableBuilder tableBuilder)
         }
     }
 
-    public Schema convertToIcebergSchema(TableDescriptor tableDescriptor) {
+    public Schema convertToIcebergSchema(TableDescriptor tableDescriptor, 
boolean isPkTable) {
         List<Types.NestedField> fields = new ArrayList<>();
         int fieldId = 1;

Review Comment:
   Could you modify `int fieldId = 1;` to `int fieldId = 0;` for I just found 
that flink/spark all from `fieldId=0` to create iceberg table field.



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