phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject phoenix git commit: PHOENIX-2987 DISTINCT/GROUP BY optimization not correct for null values in key parts.
Date Sun, 12 Jun 2016 00:46:48 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 fa88fb254 -> 0ea9f3cc5


PHOENIX-2987 DISTINCT/GROUP BY optimization not correct for null values in key parts.


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 0ea9f3cc5536c2b06d5f06f92e627ec947511a45
Parents: fa88fb2
Author: Lars Hofhansl <larsh@apache.org>
Authored: Sat Jun 11 17:47:10 2016 -0700
Committer: Lars Hofhansl <larsh@apache.org>
Committed: Sat Jun 11 17:48:10 2016 -0700

----------------------------------------------------------------------
 .../org/apache/phoenix/filter/DistinctPrefixFilter.java |  4 +---
 .../apache/phoenix/filter/DistinctPrefixFilterTest.java | 12 ++++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ea9f3cc/phoenix-core/src/main/java/org/apache/phoenix/filter/DistinctPrefixFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/DistinctPrefixFilter.java
b/phoenix-core/src/main/java/org/apache/phoenix/filter/DistinctPrefixFilter.java
index 893e068..1a1f497 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/DistinctPrefixFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/DistinctPrefixFilter.java
@@ -14,9 +14,7 @@ import org.apache.hadoop.hbase.util.Writables;
 import org.apache.hadoop.io.Writable;
 import org.apache.phoenix.schema.RowKeySchema;
 import org.apache.phoenix.schema.types.PDataType;
-import org.apache.phoenix.schema.types.PVarbinary;
 import org.apache.phoenix.util.ByteUtil;
-import org.apache.phoenix.util.ScanUtil;
 
 public class DistinctPrefixFilter extends FilterBase implements Writable {
     private static byte VERSION = 1;
@@ -24,7 +22,7 @@ public class DistinctPrefixFilter extends FilterBase implements Writable
{
     private RowKeySchema schema;
     private int prefixLengh;
     private boolean filterAll = false;
-    private final ImmutableBytesWritable lastKey = new ImmutableBytesWritable(ByteUtil.EMPTY_BYTE_ARRAY);
+    private final ImmutableBytesWritable lastKey = new ImmutableBytesWritable(ByteUtil.EMPTY_BYTE_ARRAY,
-1, -1);
 
     public DistinctPrefixFilter() {
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ea9f3cc/phoenix-core/src/test/java/org/apache/phoenix/filter/DistinctPrefixFilterTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/filter/DistinctPrefixFilterTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/filter/DistinctPrefixFilterTest.java
index c32877f..0fe4acf 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/filter/DistinctPrefixFilterTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/filter/DistinctPrefixFilterTest.java
@@ -155,6 +155,18 @@ public class DistinctPrefixFilterTest extends TestCase {
         assertSeekAndHint("00005", f, "00005\01");
     }
 
+    public void testVariableWithNull() throws Exception {
+        Filter f = createFilter(new int[]{-2,-2}, 1);
+        assertInclude("\00aa", f);
+        assertSeekAndHint("\00aa", f, "\01");
+        assertSeekAndHint("\00aa", f, "\01");
+
+        f = createFilter(new int[]{-2,-2}, 2);
+        assertInclude("\00\00", f);
+        assertSeekAndHint("\00\00", f, "\00\00\01");
+        assertSeekAndHint("\00\00", f, "\00\00\01");
+    }
+
     public void testMultiVariableWidth() throws Exception {
         Filter f = createFilter(new int[]{-5,-4}, 1);
         assertInclude("00000\00aaaa", f);


Mime
View raw message