Skip to content

Commit 2e82e2a

Browse files
committed
fix for bucket-append-ordered
1 parent 119ef8e commit 2e82e2a

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

paimon-core/src/main/java/org/apache/paimon/append/cluster/IncrementalClusterManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ public IncrementalClusterManager(
8585
FileStoreTable table, @Nullable PartitionPredicate specifiedPartitions) {
8686
checkArgument(
8787
table.primaryKeys().isEmpty(), "only append table support incremental clustering.");
88+
if (table.bucketMode() == BucketMode.HASH_FIXED) {
89+
checkArgument(
90+
!table.coreOptions().bucketAppendOrdered(),
91+
"%s must be false for incremental clustering table.",
92+
CoreOptions.BUCKET_APPEND_ORDERED.key());
93+
}
8894
this.table = table;
8995
CoreOptions options = table.coreOptions();
9096
checkArgument(

paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,10 @@ private static void validateIncrementalClustering(TableSchema schema, CoreOption
674674
"Cannot define %s for incremental clustering table.",
675675
PRIMARY_KEY.key());
676676
if (options.bucket() != -1) {
677+
checkArgument(
678+
!options.bucketAppendOrdered(),
679+
"%s must be false for incremental clustering table.",
680+
CoreOptions.BUCKET_APPEND_ORDERED.key());
677681
checkArgument(
678682
!options.deletionVectorsEnabled(),
679683
"Cannot enable deletion-vectors for incremental clustering table which bucket is not -1.");

paimon-core/src/test/java/org/apache/paimon/append/cluster/IncrementalClusterManagerTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,13 @@ public void testCreateClusterTable() {
6262
Map<String, String> options = new HashMap<>();
6363
options.put(CoreOptions.BUCKET.key(), "1");
6464
options.put(CoreOptions.BUCKET_KEY.key(), "f0");
65-
options.put(CoreOptions.DELETION_VECTORS_ENABLED.key(), "true");
65+
assertThatThrownBy(() -> createTable(options, Collections.emptyList()))
66+
.isInstanceOf(IllegalArgumentException.class)
67+
.hasMessageContaining(
68+
"bucket-append-ordered must be false for incremental clustering table.");
6669

70+
options.put(CoreOptions.BUCKET_APPEND_ORDERED.key(), "false");
71+
options.put(CoreOptions.DELETION_VECTORS_ENABLED.key(), "true");
6772
assertThatThrownBy(() -> createTable(options, Collections.emptyList()))
6873
.isInstanceOf(IllegalArgumentException.class)
6974
.hasMessageContaining(

0 commit comments

Comments
 (0)