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 a5d0d7cdf [core] Make 'ignore-delete' immutable (#3591)
a5d0d7cdf is described below
commit a5d0d7cdf0d322ce20fa1d65453404f06f3e9b15
Author: yuzelin <[email protected]>
AuthorDate: Tue Jun 25 15:06:45 2024 +0800
[core] Make 'ignore-delete' immutable (#3591)
---
.../main/java/org/apache/paimon/CoreOptions.java | 1 +
.../apache/paimon/flink/BatchFileStoreITCase.java | 23 ++++++++++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java
b/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java
index 36a2a2af2..c215a2eaa 100644
--- a/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java
+++ b/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java
@@ -310,6 +310,7 @@ public class CoreOptions implements Serializable {
.defaultValue(MergeEngine.DEDUPLICATE)
.withDescription("Specify the merge engine for table with
primary key.");
+ @Immutable
public static final ConfigOption<Boolean> IGNORE_DELETE =
key("ignore-delete")
.booleanType()
diff --git
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/BatchFileStoreITCase.java
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/BatchFileStoreITCase.java
index 08b511a10..0fe417364 100644
---
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/BatchFileStoreITCase.java
+++
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/BatchFileStoreITCase.java
@@ -19,7 +19,14 @@
package org.apache.paimon.flink;
import org.apache.paimon.CoreOptions;
+import org.apache.paimon.fs.Path;
+import org.apache.paimon.fs.local.LocalFileIO;
+import org.apache.paimon.schema.Schema;
+import org.apache.paimon.schema.SchemaManager;
+import org.apache.paimon.schema.SchemaUtils;
import org.apache.paimon.table.FileStoreTable;
+import org.apache.paimon.types.DataField;
+import org.apache.paimon.types.DataTypes;
import org.apache.paimon.utils.BlockingIterator;
import org.apache.paimon.utils.DateTimeUtils;
@@ -31,6 +38,7 @@ import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -433,7 +441,7 @@ public class BatchFileStoreITCase extends CatalogITCaseBase
{
}
@Test
- public void testIgnoreDeleteCompatible() {
+ public void testIgnoreDeleteCompatible() throws Exception {
sql(
"CREATE TABLE ignore_delete (pk INT PRIMARY KEY NOT ENFORCED,
v STRING) "
+ "WITH ('merge-engine' = 'deduplicate', 'write-only'
= 'true')");
@@ -444,7 +452,18 @@ public class BatchFileStoreITCase extends
CatalogITCaseBase {
assertThat(sql("SELECT * FROM ignore_delete")).isEmpty();
// set ignore-delete and read
- sql("ALTER TABLE ignore_delete set ('ignore-delete' = 'true')");
+ Map<String, String> newOptions = new HashMap<>();
+ newOptions.put(CoreOptions.IGNORE_DELETE.key(), "true");
+ SchemaUtils.forceCommit(
+ new SchemaManager(LocalFileIO.create(), new Path(path,
"default.db/ignore_delete")),
+ new Schema(
+ Arrays.asList(
+ new DataField(0, "pk",
DataTypes.INT().notNull()),
+ new DataField(1, "v", DataTypes.STRING())),
+ Collections.emptyList(),
+ Collections.singletonList("pk"),
+ newOptions,
+ null));
assertThat(sql("SELECT * FROM
ignore_delete")).containsExactlyInAnyOrder(Row.of(1, "A"));
}