phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maryann...@apache.org
Subject [34/50] [abbrv] phoenix git commit: PHOENIX-3501 Push limit to server for distinct optimization
Date Tue, 27 Dec 2016 18:29:57 GMT
PHOENIX-3501 Push limit to server for distinct optimization


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

Branch: refs/heads/calcite
Commit: 279eb170761dbe081a0ffe93205f3a9294f4e3ea
Parents: 9109026
Author: James Taylor <jamestaylor@apache.org>
Authored: Fri Nov 18 15:20:34 2016 -0800
Committer: James Taylor <jamestaylor@apache.org>
Committed: Fri Nov 18 15:20:34 2016 -0800

----------------------------------------------------------------------
 .../org/apache/phoenix/end2end/DistinctPrefixFilterIT.java  | 1 +
 .../org/apache/phoenix/iterate/BaseResultIterators.java     | 9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/279eb170/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctPrefixFilterIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctPrefixFilterIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctPrefixFilterIT.java
index 3d88a43..d66857d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctPrefixFilterIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctPrefixFilterIT.java
@@ -145,6 +145,7 @@ public class DistinctPrefixFilterIT extends ParallelStatsDisabledIT {
 
         testSkipRange("SELECT %s prefix1 FROM "+ testTable + " GROUP BY prefix1 ORDER BY
prefix1 DESC", 3);
         testSkipRange("SELECT %s DISTINCT prefix1 FROM " + testTable + " ORDER BY prefix1
DESC", 3);
+        testSkipRange("SELECT %s DISTINCT prefix1 FROM " + testTable + " ORDER BY prefix1
DESC LIMIT 2", 2);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/279eb170/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
index 25f3bec..51587f1 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
@@ -232,11 +232,14 @@ public abstract class BaseResultIterators extends ExplainTable implements
Result
                 !plan.getStatement().getHint().hasHint(HintNode.Hint.RANGE_SCAN) &&
                 cols < plan.getTableRef().getTable().getRowKeySchema().getFieldCount()
&&
                 plan.getGroupBy().isOrderPreserving() &&
-                (context.getAggregationManager().isEmpty() || plan.getGroupBy().isUngroupedAggregate()))
-            {
-                ScanUtil.andFilterAtEnd(context.getScan(),
+                (context.getAggregationManager().isEmpty() || plan.getGroupBy().isUngroupedAggregate()))
{
+                
+                ScanUtil.andFilterAtEnd(scan,
                         new DistinctPrefixFilter(plan.getTableRef().getTable().getRowKeySchema(),
                                 cols));
+                if (plan.getLimit() != null) { // We can push the limit to the server
+                    ScanUtil.andFilterAtEnd(scan, new PageFilter(plan.getLimit()));
+                }
             }
 
             if (optimizeProjection) {


Mime
View raw message