This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 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 ca2e8cf28b [test] Add non-overwrite with append test for strict mode
(#6676)
ca2e8cf28b is described below
commit ca2e8cf28bb697533fe2916a53352a9ed4fd50fe
Author: yuzelin <[email protected]>
AuthorDate: Wed Nov 26 11:52:40 2025 +0800
[test] Add non-overwrite with append test for strict mode (#6676)
---
.../apache/paimon/table/sink/TableCommitTest.java | 62 +++++++++++++++++++++-
1 file changed, 60 insertions(+), 2 deletions(-)
diff --git
a/paimon-core/src/test/java/org/apache/paimon/table/sink/TableCommitTest.java
b/paimon-core/src/test/java/org/apache/paimon/table/sink/TableCommitTest.java
index 10373c0377..e73695a209 100644
---
a/paimon-core/src/test/java/org/apache/paimon/table/sink/TableCommitTest.java
+++
b/paimon-core/src/test/java/org/apache/paimon/table/sink/TableCommitTest.java
@@ -383,7 +383,7 @@ public class TableCommitTest {
}
@Test
- public void testStrictModeForAppend() throws Exception {
+ public void testStrictModeForOverwriteCheckAppend() throws Exception {
String path = tempDir.toString();
RowType rowType =
RowType.of(
@@ -451,7 +451,7 @@ public class TableCommitTest {
write1 = fixedBucketWriteTable.newWrite(user1);
commit1 = fixedBucketWriteTable.newCommit(user1);
write1.write(GenericRow.of(4, 4L));
- commit1.commit(3, write1.prepareCommit(true, 3));
+ commit1.commit(3, write1.prepareCommit(false, 3));
write2.write(GenericRow.of(5, 5L));
assertThatThrownBy(() -> commit2.commit(3, write2.prepareCommit(false,
3)))
@@ -460,6 +460,64 @@ public class TableCommitTest {
"Giving up committing as
commit.strict-mode.last-safe-snapshot is set.");
}
+ @Test
+ public void testStrictModeForNonOverwriteNoCheckAppend() throws Exception {
+ String path = tempDir.toString();
+ RowType rowType =
+ RowType.of(
+ new DataType[] {DataTypes.INT(), DataTypes.BIGINT()},
+ new String[] {"k", "v"});
+
+ Options options = new Options();
+ options.set(CoreOptions.PATH, path);
+ options.set(CoreOptions.BUCKET, 1);
+ options.set(CoreOptions.NUM_SORTED_RUNS_COMPACTION_TRIGGER, 10);
+ TableSchema tableSchema =
+ SchemaUtils.forceCommit(
+ new SchemaManager(LocalFileIO.create(), new
Path(path)),
+ new Schema(
+ rowType.getFields(),
+ Collections.emptyList(),
+ Collections.singletonList("k"),
+ options.toMap(),
+ ""));
+ FileStoreTable table =
+ FileStoreTableFactory.create(
+ LocalFileIO.create(),
+ new Path(path),
+ tableSchema,
+ CatalogEnvironment.empty());
+ String user1 = UUID.randomUUID().toString();
+ FileStoreTable fixedBucketWriteTable = table;
+ TableWriteImpl<?> write1 = fixedBucketWriteTable.newWrite(user1);
+ TableCommitImpl commit1 = fixedBucketWriteTable.newCommit(user1);
+
+ Map<String, String> newOptions = new HashMap<>();
+
newOptions.put(CoreOptions.COMMIT_STRICT_MODE_LAST_SAFE_SNAPSHOT.key(), "-1");
+ table = table.copy(newOptions);
+ String user2 = UUID.randomUUID().toString();
+ TableWriteImpl<?> write2 = table.newWrite(user2);
+ TableCommitImpl commit2 = table.newCommit(user2);
+
+ // by default, first commit is not checked
+
+ write1.write(GenericRow.of(0, 0L));
+ write1.compact(BinaryRow.EMPTY_ROW, 0, true);
+ commit1.commit(1, write1.prepareCommit(true, 1));
+
+ write2.write(GenericRow.of(1, 1L));
+ commit2.commit(1, write2.prepareCommit(false, 1));
+
+ // Non overwrite doesn't check APPEND with fixed bucket files
+ write1 = fixedBucketWriteTable.newWrite(user1);
+ commit1 = fixedBucketWriteTable.newCommit(user1);
+ write1.write(GenericRow.of(2, 2L));
+ commit1.commit(2, write1.prepareCommit(false, 2));
+
+ write2.write(GenericRow.of(3, 3L));
+ commit2.commit(2, write2.prepareCommit(false, 3));
+ }
+
@Test
public void testExpireForEmptyCommit() throws Exception {
String path = tempDir.toString();