You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by la...@apache.org on 2014/09/25 17:43:58 UTC

git commit: PHOENIX-1281 Each MultiKeyValueTuple.setKeyValues creates a new immutable list object.

Repository: phoenix
Updated Branches:
  refs/heads/4.0 b2bf3f523 -> 349d04fda


PHOENIX-1281 Each MultiKeyValueTuple.setKeyValues creates a new immutable list object.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/349d04fd
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/349d04fd
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/349d04fd

Branch: refs/heads/4.0
Commit: 349d04fda90e5d0e0a080c6ca46693c890dc1046
Parents: b2bf3f5
Author: Lars Hofhansl <la...@apache.org>
Authored: Thu Sep 25 08:43:33 2014 -0700
Committer: Lars Hofhansl <la...@apache.org>
Committed: Thu Sep 25 08:43:53 2014 -0700

----------------------------------------------------------------------
 .../java/org/apache/phoenix/coprocessor/ScanRegionObserver.java | 4 +++-
 .../org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java     | 5 ++---
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/349d04fd/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
index 548aadb..8c72dd5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
@@ -63,6 +63,7 @@ import org.apache.phoenix.util.IndexUtil;
 import org.apache.phoenix.util.ScanUtil;
 import org.apache.phoenix.util.ServerUtil;
 
+import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 
 
@@ -405,7 +406,8 @@ public class ScanRegionObserver extends BaseScannerRegionObserver {
 
             private void replaceArrayIndexElement(final Set<KeyValueColumnExpression> arrayKVRefs,
                     final Expression[] arrayFuncRefs, List<Cell> result) {
-                MultiKeyValueTuple tuple = new MultiKeyValueTuple(result);
+                // make a copy of the results array here, as we're modifying it below
+                MultiKeyValueTuple tuple = new MultiKeyValueTuple(ImmutableList.copyOf(result));
                 // The size of both the arrays would be same?
                 // Using KeyValueSchema to set and retrieve the value
                 // collect the first kv to get the row

http://git-wip-us.apache.org/repos/asf/phoenix/blob/349d04fd/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
index 255c54e..53f155b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
@@ -24,8 +24,6 @@ import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.phoenix.hbase.index.util.GenericKeyValueBuilder;
 import org.apache.phoenix.util.KeyValueUtil;
 
-import com.google.common.collect.ImmutableList;
-
 
 public class MultiKeyValueTuple extends BaseTuple {
     private List<Cell> values;
@@ -37,8 +35,9 @@ public class MultiKeyValueTuple extends BaseTuple {
     public MultiKeyValueTuple() {
     }
 
+    /** Caller must not modify the list that is passed here */
     public void setKeyValues(List<Cell> values) {
-        this.values = ImmutableList.copyOf(values);
+        this.values = values;
     }
     
     @Override