diff --git a/fluss-lake/fluss-lake-iceberg/src/main/java/org/apache/fluss/lake/iceberg/IcebergLakeCatalog.java b/fluss-lake/fluss-lake-iceberg/src/main/java/org/apache/fluss/lake/iceberg/IcebergLakeCatalog.java index 9ca70b12622..7db0a1957a0 100644 --- a/fluss-lake/fluss-lake-iceberg/src/main/java/org/apache/fluss/lake/iceberg/IcebergLakeCatalog.java +++ b/fluss-lake/fluss-lake-iceberg/src/main/java/org/apache/fluss/lake/iceberg/IcebergLakeCatalog.java @@ -92,6 +92,13 @@ protected Catalog getIcebergCatalog() { @Override public void createTable(TablePath tablePath, TableDescriptor tableDescriptor, Context context) throws TableAlreadyExistException { + // validate at most one key field requirement + List keys = tableDescriptor.getBucketKeys(); + checkArgument( + keys.size() <= 1, + "Iceberg format supports at most one bucket key, but got: %s", + keys); + // convert Fluss table path to iceberg table boolean isPkTable = tableDescriptor.hasPrimaryKey(); TableIdentifier icebergId = toIcebergTableIdentifier(tablePath); diff --git a/fluss-lake/fluss-lake-iceberg/src/test/java/org/apache/fluss/lake/iceberg/IcebergLakeCatalogTest.java b/fluss-lake/fluss-lake-iceberg/src/test/java/org/apache/fluss/lake/iceberg/IcebergLakeCatalogTest.java index 991a3286884..30f2b82f1c0 100644 --- a/fluss-lake/fluss-lake-iceberg/src/test/java/org/apache/fluss/lake/iceberg/IcebergLakeCatalogTest.java +++ b/fluss-lake/fluss-lake-iceberg/src/test/java/org/apache/fluss/lake/iceberg/IcebergLakeCatalogTest.java @@ -290,8 +290,8 @@ void rejectsPrimaryKeyTableWithMultipleBucketKeys() { tablePath, tableDescriptor, new TestingLakeCatalogContext())) - .isInstanceOf(UnsupportedOperationException.class) - .hasMessageContaining("Only one bucket key is supported for Iceberg"); + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("Iceberg format supports at most one bucket key"); } @Test @@ -442,8 +442,8 @@ void rejectsLogTableWithMultipleBucketKeys() { tablePath, tableDescriptor, new TestingLakeCatalogContext())) - .isInstanceOf(UnsupportedOperationException.class) - .hasMessageContaining("Only one bucket key is supported for Iceberg"); + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("Iceberg format supports at most one bucket key"); } @ParameterizedTest