You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2014/11/14 21:30:50 UTC

[4/5] phoenix git commit: PHOENIX-1799 Support many-to-many joins

http://git-wip-us.apache.org/repos/asf/phoenix/blob/eddc846d/phoenix-core/src/main/java/org/apache/phoenix/parse/SelectStatementRewriter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/parse/SelectStatementRewriter.java b/phoenix-core/src/main/java/org/apache/phoenix/parse/SelectStatementRewriter.java
index ab06d46..3152abe 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/SelectStatementRewriter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/SelectStatementRewriter.java
@@ -52,7 +52,7 @@ public class SelectStatementRewriter extends ParseNodeRewriter {
         SelectStatementRewriter rewriter = new SelectStatementRewriter(removeNodes);
         where = where.accept(rewriter);
         // Return new SELECT statement with updated WHERE clause
-        return NODE_FACTORY.select(statement, where, statement.getHaving());
+        return NODE_FACTORY.select(statement, where);
     }
     
     /**

http://git-wip-us.apache.org/repos/asf/phoenix/blob/eddc846d/phoenix-core/src/main/java/org/apache/phoenix/schema/ValueBitSet.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/ValueBitSet.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/ValueBitSet.java
index 47acdac..7931659 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/ValueBitSet.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/ValueBitSet.java
@@ -145,10 +145,14 @@ public class ValueBitSet {
     }
     
     public void or(ImmutableBytesWritable ptr) {
-        if (schema == null) {
+        or(ptr, isVarLength() ? Bytes.SIZEOF_SHORT + 1 : Bytes.SIZEOF_SHORT);
+    }
+    
+    public void or(ImmutableBytesWritable ptr, int length) {
+        if (schema == null || length == 0) {
             return;
         }
-        if (isVarLength()) {
+        if (length > Bytes.SIZEOF_SHORT) {
             int offset = ptr.getOffset() + ptr.getLength() - Bytes.SIZEOF_SHORT;
             short nLongs = Bytes.toShort(ptr.get(), offset);
             offset -= nLongs * Bytes.SIZEOF_LONG;
@@ -160,7 +164,7 @@ public class ValueBitSet {
         } else {
             long l = Bytes.toShort(ptr.get(), ptr.getOffset() + ptr.getLength() - Bytes.SIZEOF_SHORT);
             bits[0] |= l;
-            maxSetBit = Math.max(maxSetBit, BITS_PER_SHORT - 1);
+            maxSetBit = Math.max(maxSetBit, (bits[0] == 0 ? 0 : BITS_PER_SHORT) - 1);
         }
         
     }
@@ -196,3 +200,4 @@ public class ValueBitSet {
         maxSetBit = Math.max(maxSetBit, isSet.maxSetBit);
     }
 }
+