Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,8 @@ public static void validateChainTable(TableSchema schema, CoreOptions options) {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,29 @@ public void testChainTableAllowsNonDeduplicateMergeEngine() {
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<>();
Expand Down