diff --git a/paimon-core/src/main/java/org/apache/paimon/schema/TableSchema.java b/paimon-core/src/main/java/org/apache/paimon/schema/TableSchema.java index 1322c4cdb35e5..18bf3c893602d 100644 --- a/paimon-core/src/main/java/org/apache/paimon/schema/TableSchema.java +++ b/paimon-core/src/main/java/org/apache/paimon/schema/TableSchema.java @@ -67,7 +67,7 @@ public class TableSchema implements Serializable { private final List primaryKeys; - private List bucketKeys; + private final List bucketKeys; private final int numBucket; @@ -121,10 +121,11 @@ public TableSchema( trimmedPrimaryKeys(); // try to validate and initalize the bucket keys - bucketKeys = originalBucketKeys(); - if (bucketKeys.isEmpty()) { - bucketKeys = trimmedPrimaryKeys(); + List tmpBucketKeys = originalBucketKeys(); + if (tmpBucketKeys.isEmpty()) { + tmpBucketKeys = trimmedPrimaryKeys(); } + bucketKeys = tmpBucketKeys; numBucket = CoreOptions.fromMap(options).bucket(); } diff --git a/paimon-core/src/main/java/org/apache/paimon/table/BucketSpec.java b/paimon-core/src/main/java/org/apache/paimon/table/BucketSpec.java index 036bc331d6a5e..e6dc7a5cf7ccb 100644 --- a/paimon-core/src/main/java/org/apache/paimon/table/BucketSpec.java +++ b/paimon-core/src/main/java/org/apache/paimon/table/BucketSpec.java @@ -29,9 +29,9 @@ */ public class BucketSpec { - private BucketMode bucketMode; - private List bucketKeys; - private int numBucket; + private final BucketMode bucketMode; + private final List bucketKeys; + private final int numBucket; public BucketSpec(BucketMode bucketMode, List bucketKeys, int numBucket) { this.bucketMode = bucketMode;