git commit: PHOENIX-1130 SkipScanFilter gets IndexOutOfBoundsException when intersecting salted tables (Kyle Buzsaki)

2014-07-29 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/3.0 40c2288f0 - 9ba71569b


PHOENIX-1130 SkipScanFilter gets IndexOutOfBoundsException when intersecting 
salted tables (Kyle Buzsaki)


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

Branch: refs/heads/3.0
Commit: 9ba71569befcc164e6737efff14bbdcbff166a57
Parents: 40c2288
Author: James Taylor jamestay...@apache.org
Authored: Tue Jul 29 17:15:37 2014 -0700
Committer: James Taylor jamestay...@apache.org
Committed: Tue Jul 29 17:15:37 2014 -0700

--
 .../src/main/java/org/apache/phoenix/filter/SkipScanFilter.java| 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9ba71569/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java 
b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
index 5a66e9c..d65e09c 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
@@ -210,6 +210,8 @@ public class SkipScanFilter extends FilterBase {
 if (Arrays.equals(lowerPosition, position)  areSlotsSingleKey(0, 
position.length-1)) {
 return false;
 }
+} else if (filterAllRemaining()) {
+return true;
 }
 // Copy inclusive all positions 
 for (int i = 0; i = lastSlot; i++) {



git commit: PHOENIX-1130 SkipScanFilter gets IndexOutOfBoundsException when intersecting salted tables (Kyle Buzsaki)

2014-07-29 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.0 b61d182f4 - f7f470528


PHOENIX-1130 SkipScanFilter gets IndexOutOfBoundsException when intersecting 
salted tables (Kyle Buzsaki)


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

Branch: refs/heads/4.0
Commit: f7f47052866a186ce316b317dbbdccb03170b0ac
Parents: b61d182
Author: James Taylor jamestay...@apache.org
Authored: Tue Jul 29 17:15:37 2014 -0700
Committer: James Taylor jamestay...@apache.org
Committed: Tue Jul 29 17:38:58 2014 -0700

--
 .../src/main/java/org/apache/phoenix/filter/SkipScanFilter.java| 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f7f47052/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java 
b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
index a6b8161..5d23376 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
@@ -219,6 +219,8 @@ public class SkipScanFilter extends FilterBase implements 
Writable {
 if (Arrays.equals(lowerPosition, position)  areSlotsSingleKey(0, 
position.length-1)) {
 return false;
 }
+} else if (filterAllRemaining()) {
+return true;
 }
 // Copy inclusive all positions 
 for (int i = 0; i = lastSlot; i++) {



git commit: PHOENIX-1130 SkipScanFilter gets IndexOutOfBoundsException when intersecting salted tables (Kyle Buzsaki)

2014-07-29 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master f4b05aba9 - e7868db3d


PHOENIX-1130 SkipScanFilter gets IndexOutOfBoundsException when intersecting 
salted tables (Kyle Buzsaki)


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

Branch: refs/heads/master
Commit: e7868db3d7c05cff013397024655640c64d1d4d1
Parents: f4b05ab
Author: James Taylor jamestay...@apache.org
Authored: Tue Jul 29 17:15:37 2014 -0700
Committer: James Taylor jamestay...@apache.org
Committed: Tue Jul 29 17:41:56 2014 -0700

--
 .../src/main/java/org/apache/phoenix/filter/SkipScanFilter.java| 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e7868db3/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java 
b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
index a6b8161..5d23376 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
@@ -219,6 +219,8 @@ public class SkipScanFilter extends FilterBase implements 
Writable {
 if (Arrays.equals(lowerPosition, position)  areSlotsSingleKey(0, 
position.length-1)) {
 return false;
 }
+} else if (filterAllRemaining()) {
+return true;
 }
 // Copy inclusive all positions 
 for (int i = 0; i = lastSlot; i++) {



git commit: PHOENIX-1130 SkipScanFilter gets IndexOutOfBoundsException when intersecting salted tables (Kyle Buzsaki)

2014-07-29 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.0 f7f470528 - 6a6a9c0f2


PHOENIX-1130 SkipScanFilter gets IndexOutOfBoundsException when intersecting 
salted tables (Kyle Buzsaki)


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

Branch: refs/heads/4.0
Commit: 6a6a9c0f20118a57f9e1f43a16e63f9eeaeb3d57
Parents: f7f4705
Author: James Taylor jtay...@salesforce.com
Authored: Tue Jul 29 22:11:45 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Tue Jul 29 22:13:24 2014 -0700

--
 .../apache/phoenix/end2end/SkipScanQueryIT.java | 24 +++-
 .../apache/phoenix/filter/SkipScanFilter.java   |  7 +-
 2 files changed, 29 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a6a9c0f/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
index 540197c..db5d15b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
@@ -274,4 +274,26 @@ public class SkipScanQueryIT extends 
BaseHBaseManagedTimeIT {
 }
 }
 
-}
+@Test
+public void testSkipScanIntersectionAtEnd() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+
+PreparedStatement stmt = conn.prepareStatement(create table 
splits_test 
++ (pk1 UNSIGNED_TINYINT NOT NULL, pk2 UNSIGNED_TINYINT NOT NULL, 
pk3 UNSIGNED_TINYINT NOT NULL, kv VARCHAR 
++ CONSTRAINT pk PRIMARY KEY (pk1, pk2, pk3)) SPLIT ON (?, ?, ?));
+stmt.setBytes(1, new byte[] {1, 1});
+stmt.setBytes(2, new byte[] {2, 1});
+stmt.setBytes(3, new byte[] {3, 1});
+stmt.execute();
+
+conn.createStatement().execute(upsert into splits_test values (0, 1, 
1, 'a'));
+conn.createStatement().execute(upsert into splits_test values (1, 1, 
1, 'a'));
+conn.createStatement().execute(upsert into splits_test values (2, 1, 
1, 'a'));
+conn.createStatement().execute(upsert into splits_test values (3, 1, 
1, 'a'));
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery(select count(kv) 
from splits_test where pk1 in (0, 1, 2, 3) AND pk2 = 1);
+assertTrue(rs.next());
+assertEquals(4, rs.getInt(1));
+assertFalse(rs.next());
+}}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a6a9c0f/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java 
b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
index 5d23376..13113c8 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
@@ -220,7 +220,12 @@ public class SkipScanFilter extends FilterBase implements 
Writable {
 return false;
 }
 } else if (filterAllRemaining()) {
-return true;
+// We wrapped around the position array. We know there's an 
intersection, but it can only at the last
+// slot position. So reset the position array here to the last 
position index for each slot. This will
+// be used below as the end bounds to formulate the list of 
intersecting slots.
+for (int i = 0; i = lastSlot; i++) {
+position[i] = slots.get(i).size() - 1;
+}
 }
 // Copy inclusive all positions 
 for (int i = 0; i = lastSlot; i++) {