This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 8916b6063d [core] Fix chain table sequence field validation (#7939)
8916b6063d is described below
commit 8916b6063dcbf55db3906f987601994e39d6c97d
Author: QuakeWang <[email protected]>
AuthorDate: Sat May 23 21:44:38 2026 +0800
[core] Fix chain table sequence field validation (#7939)
---
.../org/apache/paimon/schema/SchemaValidation.java | 3 ++-
.../apache/paimon/schema/SchemaValidationTest.java | 23 ++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git
a/paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java
b/paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java
index 4ffc3ec025..b703caaf9b 100644
--- a/paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java
+++ b/paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java
@@ -924,7 +924,8 @@ public class SchemaValidation {
Preconditions.checkArgument(
options.bucket() > 0, "Bucket number must be greater than
0 for chain table.");
Preconditions.checkArgument(
- options.sequenceField() != null, "Sequence field is
required for chain table.");
+ !options.sequenceField().isEmpty(),
+ "Sequence field is required for chain table.");
Preconditions.checkArgument(
changelogProducer == ChangelogProducer.NONE
|| changelogProducer == ChangelogProducer.INPUT,
diff --git
a/paimon-core/src/test/java/org/apache/paimon/schema/SchemaValidationTest.java
b/paimon-core/src/test/java/org/apache/paimon/schema/SchemaValidationTest.java
index d518f79a20..89796948f2 100644
---
a/paimon-core/src/test/java/org/apache/paimon/schema/SchemaValidationTest.java
+++
b/paimon-core/src/test/java/org/apache/paimon/schema/SchemaValidationTest.java
@@ -232,6 +232,29 @@ class SchemaValidationTest {
assertThatNoException().isThrownBy(() -> validateTableSchema(schema));
}
+ @Test
+ public void testChainTableRequiresSequenceField() {
+ Map<String, String> options = new HashMap<>();
+ options.put(CoreOptions.CHAIN_TABLE_ENABLED.key(), "true");
+ options.put(CoreOptions.BUCKET.key(), "1");
+ options.put(CoreOptions.PARTITION_TIMESTAMP_PATTERN.key(), "$f0");
+ options.put(CoreOptions.PARTITION_TIMESTAMP_FORMATTER.key(),
"yyyy-MM-dd");
+
+ List<DataField> fields =
+ Arrays.asList(
+ new DataField(0, "f0", DataTypes.STRING()),
+ new DataField(1, "f1", DataTypes.INT()),
+ new DataField(2, "f2", DataTypes.BIGINT()),
+ new DataField(3, "f3", DataTypes.STRING()));
+ List<String> partitionKeys = singletonList("f0");
+ List<String> primaryKeys = Arrays.asList("f0", "f1");
+ TableSchema schema =
+ new TableSchema(1, fields, 10, partitionKeys, primaryKeys,
options, "");
+
+ assertThatThrownBy(() -> validateTableSchema(schema))
+ .hasMessage("Sequence field is required for chain table.");
+ }
+
@Test
public void testVectorStoreUnknownColumn() {
Map<String, String> options = new HashMap<>();