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 26ba91038f [flink] Fail fast validation for delete with write-only 
mode enabled (#6153)
26ba91038f is described below

commit 26ba91038f9d007042aee0efaa1d07e4eb9475ee
Author: Arnav Balyan <[email protected]>
AuthorDate: Sun May 24 08:25:19 2026 +0530

    [flink] Fail fast validation for delete with write-only mode enabled (#6153)
---
 .../apache/paimon/flink/action/DeleteAction.java   |  7 +++-
 .../paimon/flink/action/DeleteActionITCase.java    | 37 ++++++++++++++++++++++
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git 
a/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action/DeleteAction.java
 
b/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action/DeleteAction.java
index ed9423cf52..db63ab0edf 100644
--- 
a/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action/DeleteAction.java
+++ 
b/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action/DeleteAction.java
@@ -54,7 +54,12 @@ public class DeleteAction extends TableActionBase {
 
     @Override
     public void run() throws Exception {
-        CoreOptions.MergeEngine mergeEngine = 
CoreOptions.fromMap(table.options()).mergeEngine();
+        CoreOptions coreOptions = CoreOptions.fromMap(table.options());
+        if (coreOptions.writeOnly()) {
+            throw new UnsupportedOperationException(
+                    "DELETE is not supported when 'write-only'='true'. Remove 
the hint or set it to false for the target table.");
+        }
+        CoreOptions.MergeEngine mergeEngine = coreOptions.mergeEngine();
         if (mergeEngine != DEDUPLICATE) {
             throw new UnsupportedOperationException(
                     String.format(
diff --git 
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/action/DeleteActionITCase.java
 
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/action/DeleteActionITCase.java
index 02ab4fd286..dbbc6104c5 100644
--- 
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/action/DeleteActionITCase.java
+++ 
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/action/DeleteActionITCase.java
@@ -44,6 +44,7 @@ import static 
org.apache.paimon.flink.util.ReadWriteTableTestUtil.init;
 import static 
org.apache.paimon.flink.util.ReadWriteTableTestUtil.testStreamingRead;
 import static 
org.apache.paimon.flink.util.ReadWriteTableTestUtil.validateStreamingReadResult;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /** IT cases for {@link DeleteAction}. */
 public class DeleteActionITCase extends ActionITCaseBase {
@@ -125,4 +126,40 @@ public class DeleteActionITCase extends ActionITCaseBase {
         assertThat(snapshot.id()).isEqualTo(1);
         
assertThat(snapshot.commitKind()).isEqualTo(Snapshot.CommitKind.APPEND);
     }
+
+    @Test
+    public void testDeleteActionWriteOnlyRejected() throws Exception {
+        Map<String, String> options = new HashMap<>();
+        options.put("write-only", "true");
+        FileStoreTable table =
+                createFileStoreTable(
+                        ROW_TYPE,
+                        Collections.emptyList(),
+                        Collections.singletonList("k"),
+                        Collections.emptyList(),
+                        options);
+        StreamWriteBuilder streamWriteBuilder =
+                table.newStreamWriteBuilder().withCommitUser(commitUser);
+        write = streamWriteBuilder.newWrite();
+        commit = streamWriteBuilder.newCommit();
+        writeData(rowData(1L, BinaryString.fromString("A")));
+        commit.commit(0, write.prepareCommit(true, 0));
+
+        DeleteAction action =
+                createAction(
+                        DeleteAction.class,
+                        "delete",
+                        "--warehouse",
+                        warehouse,
+                        "--database",
+                        database,
+                        "--table",
+                        tableName,
+                        "--where",
+                        "k=1");
+
+        assertThatThrownBy(action::run)
+                .isInstanceOf(UnsupportedOperationException.class)
+                .hasMessageContaining("write-only");
+    }
 }

Reply via email to