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 2018/04/06 00:38:41 UTC
phoenix git commit: PHOENIX-4616 Move join query optimization out
from QueryCompiler into QueryOptimizer (addendum)
Repository: phoenix
Updated Branches:
refs/heads/master 701c447d3 -> 49fca494b
PHOENIX-4616 Move join query optimization out from QueryCompiler into QueryOptimizer (addendum)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/49fca494
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/49fca494
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/49fca494
Branch: refs/heads/master
Commit: 49fca494bf9e13918db558e8276676e3dfda9d74
Parents: 701c447
Author: maryannxue <ma...@gmail.com>
Authored: Thu Apr 5 17:38:30 2018 -0700
Committer: maryannxue <ma...@gmail.com>
Committed: Thu Apr 5 17:38:30 2018 -0700
----------------------------------------------------------------------
.../java/org/apache/phoenix/optimize/QueryOptimizer.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/49fca494/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 31f5c34..3a2d11e 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
@@ -38,7 +38,6 @@ import org.apache.phoenix.compile.SequenceManager;
import org.apache.phoenix.compile.StatementContext;
import org.apache.phoenix.compile.StatementNormalizer;
import org.apache.phoenix.compile.SubqueryRewriter;
-import org.apache.phoenix.execute.BaseQueryPlan;
import org.apache.phoenix.iterate.ParallelIteratorFactory;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.jdbc.PhoenixStatement;
@@ -126,11 +125,11 @@ public class QueryOptimizer {
return Collections.singletonList(dataPlan);
}
- if (dataPlan instanceof BaseQueryPlan) {
- return getApplicablePlans((BaseQueryPlan) dataPlan, statement, targetColumns, parallelIteratorFactory, stopAtBestPlan);
+ SelectStatement select = (SelectStatement) dataPlan.getStatement();
+ if (!select.isUnion() && !select.isJoin() && select.getInnerSelectStatement() == null) {
+ return getApplicablePlansForSingleFlatQuery(dataPlan, statement, targetColumns, parallelIteratorFactory, stopAtBestPlan);
}
- SelectStatement select = (SelectStatement) dataPlan.getStatement();
ColumnResolver resolver = FromCompiler.getResolverForQuery(select, statement.getConnection());
Map<TableRef, QueryPlan> dataPlans = null;
@@ -187,7 +186,7 @@ public class QueryOptimizer {
return Collections.singletonList(compiler.compile());
}
- private List<QueryPlan> getApplicablePlans(BaseQueryPlan dataPlan, PhoenixStatement statement, List<? extends PDatum> targetColumns, ParallelIteratorFactory parallelIteratorFactory, boolean stopAtBestPlan) throws SQLException {
+ private List<QueryPlan> getApplicablePlansForSingleFlatQuery(QueryPlan dataPlan, PhoenixStatement statement, List<? extends PDatum> targetColumns, ParallelIteratorFactory parallelIteratorFactory, boolean stopAtBestPlan) throws SQLException {
SelectStatement select = (SelectStatement)dataPlan.getStatement();
// Exit early if we have a point lookup as we can't get better than that
if (dataPlan.getContext().getScanRanges().isPointLookup() && stopAtBestPlan) {