kadirozde commented on a change in pull request #701: PHOENIX-5709 Simplify 
index update generation code for consistent glo…
URL: https://github.com/apache/phoenix/pull/701#discussion_r376889375
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java
 ##########
 @@ -409,91 +413,220 @@ private void populatePendingRows(BatchMutateContext 
context) {
       }
   }
 
-  private Collection<? extends Mutation> 
groupMutations(MiniBatchOperationInProgress<Mutation> miniBatchOp,
-                                                        long now, ReplayWrite 
replayWrite) throws IOException {
-      Map<ImmutableBytesPtr, MultiMutation> mutationsMap = new HashMap<>();
-      boolean copyMutations = false;
-      for (int i = 0; i < miniBatchOp.size(); i++) {
+  public static void setTimestamp(Mutation m, long ts) throws IOException {
+      for (List<Cell> cells : m.getFamilyCellMap().values()) {
+          for (Cell cell : cells) {
+              CellUtil.setTimestamp(cell, ts);
+          }
+      }
+  }
+
+    public static long getTimestamp(Mutation m) throws IOException {
+        for (List<Cell> cells : m.getFamilyCellMap().values()) {
+            for (Cell cell : cells) {
+                return cell.getTimestamp();
+            }
+        }
+        return 0;
+    }
+
+  private static void removeColumn(Put put, Cell deleteCell) {
+      byte[] family = CellUtil.cloneFamily(deleteCell);
+      List<Cell> cellList = put.getFamilyCellMap().get(family);
+      if (cellList == null) {
+          return;
+      }
+      Iterator<Cell> cellIterator = cellList.iterator();
+      while (cellIterator.hasNext()) {
+          Cell cell = cellIterator.next();
+          if (Bytes.compareTo(cell.getQualifierArray(), 
cell.getQualifierOffset(), cell.getQualifierLength(),
+                  deleteCell.getQualifierArray(), 
deleteCell.getQualifierOffset(), deleteCell.getQualifierLength()) == 0) {
+              cellIterator.remove();
+              if (cellList.isEmpty()) {
+                  put.getFamilyCellMap().remove(family);
+              }
+              return;
+          }
+      }
 
 Review comment:
   We do not know upfront if the family or column delete cell refers to exists 
in the mutation. It may or may not exist.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to