phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maryann...@apache.org
Subject [3/5] git commit: PHOENIX-944 Support derived tables in FROM clause that needs extra steps of client-side aggregation or other processing
Date Sat, 01 Nov 2014 19:00:25 GMT
PHOENIX-944 Support derived tables in FROM clause that needs extra steps of client-side aggregation
or other processing


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

Branch: refs/heads/4.0
Commit: 301f87ea2d3f2f8749010592f225f71924ab3c16
Parents: f004e13
Author: maryannxue <maryannxue@apache.org>
Authored: Thu Oct 23 20:26:17 2014 -0400
Committer: maryannxue <maryannxue@apache.org>
Committed: Thu Oct 23 23:26:49 2014 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/phoenix/compile/QueryCompiler.java    | 4 ++++
 .../java/org/apache/phoenix/execute/ClientAggregatePlan.java   | 4 +++-
 .../org/apache/phoenix/iterate/LookAheadResultIterator.java    | 6 +++---
 3 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/301f87ea/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
index 0eafcdb..214330c 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
@@ -43,6 +43,7 @@ import org.apache.phoenix.execute.ScanPlan;
 import org.apache.phoenix.execute.TupleProjectionPlan;
 import org.apache.phoenix.execute.TupleProjector;
 import org.apache.phoenix.expression.Expression;
+import org.apache.phoenix.expression.LiteralExpression;
 import org.apache.phoenix.expression.RowValueConstructorExpression;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 import org.apache.phoenix.iterate.ParallelIterators.ParallelIteratorFactory;
@@ -427,6 +428,9 @@ public class QueryCompiler {
         }
         
         if (innerPlan != null) {
+            if (LiteralExpression.isTrue(where)) {
+                where = null; // we do not pass "true" as filter
+            }
             plan =  select.isAggregate() || select.isDistinct() ?
                       new ClientAggregatePlan(context, select, tableRef, projector, limit,
where, orderBy, groupBy, having, plan)
                     : new ClientScanPlan(context, select, tableRef, projector, limit, where,
orderBy, plan);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/301f87ea/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientAggregatePlan.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientAggregatePlan.java
b/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientAggregatePlan.java
index a9347e1..59aab2d 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientAggregatePlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientAggregatePlan.java
@@ -17,6 +17,8 @@
  */
 package org.apache.phoenix.execute;
 
+import static org.apache.phoenix.query.QueryConstants.*;
+
 import java.io.IOException;
 import java.sql.SQLException;
 import java.util.Collections;
@@ -210,7 +212,7 @@ public class ClientAggregatePlan extends ClientProcessingPlan {
         @Override
         protected ImmutableBytesWritable getGroupingKey(Tuple tuple,
                 ImmutableBytesWritable ptr) throws SQLException {
-            tuple.getKey(ptr);
+            ptr.set(UNGROUPED_AGG_ROW_KEY);
             return ptr;
         }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/301f87ea/phoenix-core/src/main/java/org/apache/phoenix/iterate/LookAheadResultIterator.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/LookAheadResultIterator.java
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/LookAheadResultIterator.java
index 971b1a5..3293f65 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/LookAheadResultIterator.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/LookAheadResultIterator.java
@@ -25,9 +25,9 @@ import org.apache.phoenix.schema.tuple.Tuple;
 
 
 abstract public class LookAheadResultIterator implements PeekingResultIterator {
-    public static LookAheadResultIterator wrap(final ResultIterator iterator) {
-        if (iterator instanceof LookAheadResultIterator) {
-            return (LookAheadResultIterator) iterator;
+    public static PeekingResultIterator wrap(final ResultIterator iterator) {
+        if (iterator instanceof PeekingResultIterator) {
+            return (PeekingResultIterator) iterator;
         }
         
         return new LookAheadResultIterator() {


Mime
View raw message