Repository: phoenix
Updated Branches:
refs/heads/3.0 3719b6db3 -> 5e48b32b4
PHOENIX-1298 Queries on fixed width type columns that have an index declared on
them don't use that index
Conflicts:
phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5e48b32b
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5e48b32b
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5e48b32b
Branch: refs/heads/3.0
Commit: 5e48b32b4e0015e91c7457c87e27011ab6833c20
Parents: 3719b6d
Author: James Taylor <[email protected]>
Authored: Sat Sep 27 00:35:54 2014 -0700
Committer: James Taylor <[email protected]>
Committed: Sat Sep 27 00:40:38 2014 -0700
----------------------------------------------------------------------
.../apache/phoenix/compile/WhereOptimizer.java | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/5e48b32b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
----------------------------------------------------------------------
diff --git
a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
index 0aac822..9cd7e01 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
@@ -476,10 +476,22 @@ public class WhereOptimizer {
for (int i = 0; i < childSlots.size(); i++) {
KeySlots slots = childSlots.get(i);
KeySlot keySlot = slots.iterator().next();
+ List<Expression> childExtractNodes =
keySlot.getKeyPart().getExtractNodes();
+ // Stop if there was a gap in extraction of RVC elements. This
is required if the leading
+ // RVC has not row key columns, as we'll still get childSlots
if the RVC has trailing row
+ // key columns. We can't rule the RVC out completely when the
childSlots is less the the
+ // RVC length, as a partial, *leading* match is optimizable.
+ if (childExtractNodes.size() != 1 ||
!childExtractNodes.get(0).equals(rvc.getChildren().get(i))) {
+ break;
+ }
+ int pkPosition = keySlot.getPKPosition();
+ if (pkPosition < 0) { // break for non PK columns
+ break;
+ }
// Continue while we have consecutive pk columns
if (position == -1) {
- position = initialPosition = keySlot.getPKPosition();
- } else if (keySlot.getPKPosition() != position) {
+ position = initialPosition = pkPosition;
+ } else if (pkPosition != position) {
break;
}
position++;
@@ -518,6 +530,7 @@ public class WhereOptimizer {
if (isDegenerate(slot.getKeyRanges())) {
return DEGENERATE_KEY_PARTS;
}
+ final List<Expression> extractNodes =
Collections.<Expression>singletonList(node);
final KeyPart childPart = slot.getKeyPart();
final ImmutableBytesWritable ptr = context.getTempPtr();
return new SingleKeySlot(new KeyPart() {
@@ -547,7 +560,7 @@ public class WhereOptimizer {
@Override
public List<Expression> getExtractNodes() {
- return childPart.getExtractNodes();
+ return extractNodes;
}
@Override