hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gunt...@apache.org
Subject svn commit: r1614803 - in /hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql: optimizer/optiq/reloperators/HiveJoinRel.java optimizer/optiq/translator/DerivedTableInjector.java parse/SemanticAnalyzer.java
Date Thu, 31 Jul 2014 02:53:44 GMT
Author: gunther
Date: Thu Jul 31 02:53:44 2014
New Revision: 1614803

URL: http://svn.apache.org/r1614803
Log:
HIVE-7565: Fix exception in Greedy Join reordering Algo (Laljo John Pullokkaran via Gunther
Hagleitner)

Modified:
    hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/reloperators/HiveJoinRel.java
    hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/DerivedTableInjector.java
    hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java

Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/reloperators/HiveJoinRel.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/reloperators/HiveJoinRel.java?rev=1614803&r1=1614802&r2=1614803&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/reloperators/HiveJoinRel.java
(original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/reloperators/HiveJoinRel.java
Thu Jul 31 02:53:44 2014
@@ -11,6 +11,7 @@ import org.apache.hadoop.hive.ql.optimiz
 import org.eigenbase.rel.InvalidRelException;
 import org.eigenbase.rel.JoinRelBase;
 import org.eigenbase.rel.JoinRelType;
+import org.eigenbase.rel.RelFactories.JoinFactory;
 import org.eigenbase.rel.RelNode;
 import org.eigenbase.relopt.RelOptCluster;
 import org.eigenbase.relopt.RelOptCost;
@@ -35,6 +36,8 @@ public class HiveJoinRel extends JoinRel
   public enum MapJoinStreamingRelation {
     NONE, LEFT_RELATION, RIGHT_RELATION
   }
+  
+  public static final JoinFactory HIVE_JOIN_FACTORY = new HiveJoinFactoryImpl();
 
   private final boolean m_leftSemiJoin;
   private final JoinAlgorithm      m_joinAlgorithm;
@@ -121,4 +124,30 @@ public class HiveJoinRel extends JoinRel
     }
     return super.deriveRowType();
   }
+
+  private static class HiveJoinFactoryImpl implements JoinFactory {
+    /**
+     * Creates a join.
+     * 
+     * @param left
+     *          Left input
+     * @param right
+     *          Right input
+     * @param condition
+     *          Join condition
+     * @param joinType
+     *          Join type
+     * @param variablesStopped
+     *          Set of names of variables which are set by the LHS and used by
+     *          the RHS and are not available to nodes above this JoinRel in the
+     *          tree
+     * @param semiJoinDone
+     *          Whether this join has been translated to a semi-join
+     */
+    @Override
+    public RelNode createJoin(RelNode left, RelNode right, RexNode condition, JoinRelType
joinType,
+        Set<String> variablesStopped, boolean semiJoinDone) {
+      return getJoin(left.getCluster(), left, right, condition, joinType, false);
+    }
+  }
 }

Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/DerivedTableInjector.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/DerivedTableInjector.java?rev=1614803&r1=1614802&r2=1614803&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/DerivedTableInjector.java
(original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/DerivedTableInjector.java
Thu Jul 31 02:53:44 2014
@@ -5,7 +5,6 @@ import java.util.List;
 
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
 import org.apache.hadoop.hive.ql.optimizer.optiq.reloperators.HiveAggregateRel;
-import org.apache.hadoop.hive.ql.optimizer.optiq.reloperators.HiveJoinRel;
 import org.apache.hadoop.hive.ql.optimizer.optiq.reloperators.HiveProjectRel;
 import org.apache.hadoop.hive.ql.optimizer.optiq.reloperators.HiveSortRel;
 import org.eigenbase.rel.AggregateRelBase;
@@ -48,7 +47,7 @@ public class DerivedTableInjector {
       // TODO: replace with null scan
     } else if (rel instanceof HepRelVertex) {
       // TODO: is this relevant?
-    } else if (rel instanceof HiveJoinRel) {
+    } else if (rel instanceof JoinRelBase) {
       if (!validJoinParent(rel, parent)) {
         introduceDerivedTable(rel, parent);
       }

Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=1614803&r1=1614802&r2=1614803&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Thu
Jul 31 02:53:44 2014
@@ -229,6 +229,7 @@ import org.eigenbase.rel.InvalidRelExcep
 import org.eigenbase.rel.JoinRelType;
 import org.eigenbase.rel.RelCollation;
 import org.eigenbase.rel.RelCollationImpl;
+import org.eigenbase.rel.RelFactories;
 import org.eigenbase.rel.RelFieldCollation;
 import org.eigenbase.rel.RelNode;
 import org.eigenbase.rel.metadata.CachingRelMetadataProvider;
@@ -11869,7 +11870,7 @@ public class SemanticAnalyzer extends Ba
       } else {
         final HepProgram hepPgm = new HepProgramBuilder().addMatchOrder(HepMatchOrder.BOTTOM_UP)
             .addRuleInstance(new ConvertMultiJoinRule(HiveJoinRel.class))
-            .addRuleInstance(LoptOptimizeJoinRule.INSTANCE).build();
+            .addRuleInstance(new LoptOptimizeJoinRule(HiveJoinRel.HIVE_JOIN_FACTORY)).build();
 
         HepPlanner hepPlanner = new HepPlanner(hepPgm);
 



Mime
View raw message