phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject git commit: PHOENIX-1032 Don't compile alternate plans if query is a point lookup
Date Sun, 08 Jun 2014 18:40:47 GMT
Repository: phoenix
Updated Branches:
  refs/heads/master 156e6cc2d -> 318921eae


PHOENIX-1032 Don't compile alternate plans if query is a point lookup


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

Branch: refs/heads/master
Commit: 318921eaef93dd5315c144b0f9c22dcf4febabc2
Parents: 156e6cc
Author: James Taylor <jtaylor@salesforce.com>
Authored: Sun Jun 8 11:40:15 2014 -0700
Committer: James Taylor <jtaylor@salesforce.com>
Committed: Sun Jun 8 11:40:15 2014 -0700

----------------------------------------------------------------------
 .../java/org/apache/phoenix/optimize/QueryOptimizer.java    | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/318921ea/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java b/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
index 76276e4..53e6939 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
@@ -76,11 +76,12 @@ public class QueryOptimizer {
     }
     
     public QueryPlan optimize(QueryPlan dataPlan, PhoenixStatement statement, List<? extends
PDatum> targetColumns, ParallelIteratorFactory parallelIteratorFactory) throws SQLException
{
-        // Get the statement as it's been normalized now
-        // TODO: the recompile for the index tables could skip the normalize step
         SelectStatement select = (SelectStatement)dataPlan.getStatement();
-        // TODO: consider not even compiling index plans if we have a point lookup
-        if (!useIndexes || select.isJoin() || dataPlan.getContext().getResolver().getTables().size()
> 1) {
+        // Exit early if we have a point lookup as we can't get better than that
+        if (!useIndexes 
+                || select.isJoin() 
+                || dataPlan.getContext().getResolver().getTables().size() > 1
+                || dataPlan.getContext().getScanRanges().isPointLookup()) {
             return dataPlan;
         }
         PTable dataTable = dataPlan.getTableRef().getTable();


Mime
View raw message