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/02/22 01:25:06 UTC

[2/2] git commit: PHOENIX-68 Add Option "FAVOR_STAR_JOIN" to indicate if star join optimization is preferred for multi inner join queries

PHOENIX-68 Add Option "FAVOR_STAR_JOIN" to indicate if star join optimization is preferred for multi inner join queries


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

Branch: refs/heads/master
Commit: 67c9615161420e14ee92ce1acf570a0f92d2d70b
Parents: 8fe0dd9
Author: maryannxue <ma...@apache.org>
Authored: Fri Feb 21 19:23:59 2014 -0500
Committer: maryannxue <ma...@apache.org>
Committed: Fri Feb 21 19:23:59 2014 -0500

----------------------------------------------------------------------
 .../java/org/apache/phoenix/compile/JoinCompiler.java    | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/67c96151/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java
index 43b45c1..ef2b92e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java
@@ -117,7 +117,6 @@ public class JoinCompiler {
             this.origResolver = resolver;
             List<AliasedNode> selectList = statement.getSelect();
             List<TableNode> tableNodes = statement.getFrom();
-            HintNode hint = statement.getHint();
             assert (tableNodes.size() > 1);
             Iterator<TableNode> iter = tableNodes.iterator();
             Iterator<TableRef> tableRefIter = resolver.getTables().iterator();
@@ -127,7 +126,7 @@ public class JoinCompiler {
             this.joinTables = new ArrayList<JoinTable>(tableNodes.size() - 1);
             this.preFilters = new ArrayList<ParseNode>();
             this.postFilters = new ArrayList<ParseNode>();
-            this.useStarJoin = !hint.hasHint(Hint.NO_STAR_JOIN);
+            this.useStarJoin = !statement.getHint().hasHint(Hint.NO_STAR_JOIN);
             this.tableRefToJoinTableMap = new HashMap<TableRef, JoinTable>();
             ColumnParseNodeVisitor generalRefVisitor = new ColumnParseNodeVisitor(resolver);
             ColumnParseNodeVisitor joinLocalRefVisitor = new ColumnParseNodeVisitor(resolver);
@@ -140,7 +139,7 @@ public class JoinCompiler {
                 if (!(tableNode instanceof JoinTableNode))
                     throw new SQLFeatureNotSupportedException("Implicit joins not supported.");
                 JoinTableNode joinTableNode = (JoinTableNode) tableNode;
-                JoinTable joinTable = new JoinTable(joinTableNode, tableRefIter.next(), selectList, hint, resolver);
+                JoinTable joinTable = new JoinTable(joinTableNode, tableRefIter.next(), statement, resolver);
                 for (ParseNode condition : joinTable.conditions) {
                     ComparisonParseNode comparisonNode = (ComparisonParseNode) condition;
                     comparisonNode.getLHS().accept(generalRefVisitor);
@@ -547,15 +546,15 @@ public class JoinCompiler {
         
         private Set<TableRef> leftTableRefs;
         
-        public JoinTable(JoinTableNode node, TableRef tableRef, List<AliasedNode> select, HintNode hint, ColumnResolver resolver) throws SQLException {
+        public JoinTable(JoinTableNode node, TableRef tableRef, SelectStatement statement, ColumnResolver resolver) throws SQLException {
             if (!(node.getTable() instanceof ConcreteTableNode))
                 throw new SQLFeatureNotSupportedException("Subqueries not supported.");
             
             this.type = node.getType();
             this.tableNode = node.getTable();
             this.table = tableRef;
-            this.select = extractFromSelect(select,tableRef,resolver);
-            this.hint = hint;
+            this.select = extractFromSelect(statement.getSelect(),tableRef,resolver);
+            this.hint = statement.getHint();
             this.preFilters = new ArrayList<ParseNode>();
             this.conditions = new ArrayList<ParseNode>();
             this.leftTableRefs = new HashSet<TableRef>();