comnetwork commented on a change in pull request #638: PHOENIX-5494
URL: https://github.com/apache/phoenix/pull/638#discussion_r348321577
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/data/CachedLocalTable.java
 ##########
 @@ -0,0 +1,49 @@
+package org.apache.phoenix.hbase.index.covered.data;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.client.Mutation;
+import org.apache.phoenix.hbase.index.covered.update.ColumnReference;
+import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
+
+import java.util.HashMap;
+
+public class CachedLocalTable implements LocalHBaseState {
+
+    private final HashMap<ImmutableBytesPtr, List<Cell>> rowKeyPtrToCells;
+
+    public CachedLocalTable(HashMap<ImmutableBytesPtr, List<Cell>> 
rowKeyPtrToCells)
+    {
+        this.rowKeyPtrToCells = rowKeyPtrToCells;
+    }
+
+    @Override
+    public List<Cell> getCurrentRowState(
+            Mutation mutation,
+            Collection<? extends ColumnReference> columnReferences,
+            boolean ignoreNewerMutations) throws IOException {
+        byte[] rowKey = mutation.getRow();
+        List<Cell> cells = this.rowKeyPtrToCells.get(new 
ImmutableBytesPtr(rowKey));
+
+        if(cells == null || cells.isEmpty()) {
+            return cells;
+        }
+        if(!ignoreNewerMutations) {
+            return cells;
+        }
+        long timestamp =
 
 Review comment:
   Yes , we can guarantee that all cells in a mutation have the the same 
timestamp
   because the previous IndexManagementUtil.flattenMutationsByTimestamp. I 
would add more comments for it.

----------------------------------------------------------------
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