virajjasani commented on code in PR #1884:
URL: https://github.com/apache/phoenix/pull/1884#discussion_r1618082802


##########
phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java:
##########
@@ -1588,10 +1680,36 @@ private List<Mutation> 
generateOnDupMutations(BatchMutateContext context, Put at
               delete.add(cell);
           }
       }
+
+      if (put != null) {
+          // if put is empty and delete is null, remove the empty put from 
mutations,
+          // otherwise we should also add empty cell timestamp for update
+          if (put.isEmpty() && delete == null) {
+              mutations.remove(put);
+          } else {
+              addEmptyKVCells(put, delete, tuple);
+          }
+      }
+
       return mutations;
   }
 
-
+    private void addEmptyKVCells(Put put, Delete delete, MultiKeyValueTuple 
tuple) throws IOException {
+        Set<byte[]> familySet = new HashSet<>();
+        if (!put.isEmpty()) {
+            familySet.addAll(put.getFamilyCellMap().keySet());
+        }
+        if (delete != null) {
+            familySet.addAll(delete.getFamilyCellMap().keySet());
+        }
+        for (byte[] familyBytes : familySet) {
+            Cell emptyKVCell = tuple.getValue(familyBytes,
+                    QueryConstants.ENCODED_EMPTY_COLUMN_BYTES);

Review Comment:
   +1, we need to use `EncodedColumnsUtil#usesEncodedColumnNames(PTable)` with 
the PTable object to determine whether empty column need to be encoded, else 
use `EMPTY_COLUMN_BYTES`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to