This is an automated email from the ASF dual-hosted git repository.

granthenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 24943aa  KUDU-1563: Fix DELETE_IGNORE operations with extra columns set
24943aa is described below

commit 24943aa5e51d25c532f20887fd21b246c973021c
Author: Grant Henke <[email protected]>
AuthorDate: Fri Oct 30 11:37:28 2020 -0500

    KUDU-1563: Fix DELETE_IGNORE operations with extra columns set
    
    In commit 17fb5a1 the Java client was enhanced to support extra
    columns set on DELETE operations. This patch ensures the same
    functionality works with DELETE_IGNORE operations.
    
    Change-Id: I179c2085c5061c71dc010929056247340f062b8c
    Reviewed-on: http://gerrit.cloudera.org:8080/16682
    Tested-by: Grant Henke <[email protected]>
    Reviewed-by: Andrew Wong <[email protected]>
    Reviewed-by: Alexey Serbin <[email protected]>
---
 .../src/main/java/org/apache/kudu/client/Operation.java    |  2 +-
 .../test/java/org/apache/kudu/client/TestKuduSession.java  | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git 
a/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java 
b/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java
index 7963ccf..4981d5e 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java
@@ -383,7 +383,7 @@ public abstract class Operation extends 
KuduRpc<OperationResponse> {
       BitSet nullsBitSet = row.getNullsBitSet();
 
       // If this is a DELETE operation only the key columns should to be set.
-      if (type == ChangeType.DELETE) {
+      if (type == ChangeType.DELETE || type == ChangeType.DELETE_IGNORE) {
         columnCount = row.getSchema().getPrimaryKeyColumnCount();
         // Clear the bits indicating any non-key fields are set.
         columnsBitSet.clear(schema.getPrimaryKeyColumnCount(), 
columnsBitSet.size());
diff --git 
a/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduSession.java 
b/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduSession.java
index f0364ec..52e2571 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduSession.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduSession.java
@@ -193,7 +193,12 @@ public class TestKuduSession {
     session.flush();
 
     for (PartialRow row : rows) {
-      Delete del = table.newDelete();
+      Operation del;
+      if (row.getInt(0) % 2 == 0) {
+        del = table.newDelete();
+      } else {
+        del = table.newDeleteIgnore();
+      }
       del.setRow(row);
       session.apply(del);
     }
@@ -239,7 +244,12 @@ public class TestKuduSession {
     session.flush();
 
     for (PartialRow row : rows) {
-      Delete del = table.newDelete();
+      Operation del;
+      if (row.getInt(0) % 2 == 0) {
+        del = table.newDelete();
+      } else {
+        del = table.newDeleteIgnore();
+      }
       del.setRow(row);
       session.apply(del);
     }

Reply via email to