hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1674197 - /hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/HiveOpConverter.java
Date Fri, 17 Apr 2015 03:42:09 GMT
Author: hashutosh
Date: Fri Apr 17 03:42:09 2015
New Revision: 1674197

URL: http://svn.apache.org/r1674197
Log:
HIVE-10371 : CBO (Calcite Return Path): Tag not set up correctly for Join operator in HiveOpConverter
(Jesus Camacho Rodriguez via Ashutosh Chauhan)

Modified:
    hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/HiveOpConverter.java

Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/HiveOpConverter.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/HiveOpConverter.java?rev=1674197&r1=1674196&r2=1674197&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/HiveOpConverter.java
(original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/HiveOpConverter.java
Fri Apr 17 03:42:09 2015
@@ -35,7 +35,6 @@ import org.apache.calcite.rel.RelFieldCo
 import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.core.SemiJoin;
 import org.apache.calcite.rel.core.SortExchange;
-import org.apache.calcite.rel.logical.LogicalExchange;
 import org.apache.calcite.rex.RexInputRef;
 import org.apache.calcite.rex.RexLiteral;
 import org.apache.calcite.rex.RexNode;
@@ -47,7 +46,6 @@ import org.apache.hadoop.hive.ql.ErrorMs
 import org.apache.hadoop.hive.ql.exec.ColumnInfo;
 import org.apache.hadoop.hive.ql.exec.FilterOperator;
 import org.apache.hadoop.hive.ql.exec.JoinOperator;
-import org.apache.hadoop.hive.ql.exec.LimitOperator;
 import org.apache.hadoop.hive.ql.exec.Operator;
 import org.apache.hadoop.hive.ql.exec.OperatorFactory;
 import org.apache.hadoop.hive.ql.exec.ReduceSinkOperator;
@@ -116,7 +114,6 @@ public class HiveOpConverter {
   private final UnparseTranslator                             unparseTranslator;
   private final Map<String, Operator<? extends OperatorDesc>> topOps;
   private final boolean                                       strictMode;
-  private int                                                 reduceSinkTagGenerator;
 
   public HiveOpConverter(SemanticAnalyzer semanticAnalyzer, HiveConf hiveConf,
       UnparseTranslator unparseTranslator, Map<String, Operator<? extends OperatorDesc>>
topOps,
@@ -126,7 +123,6 @@ public class HiveOpConverter {
     this.unparseTranslator = unparseTranslator;
     this.topOps = topOps;
     this.strictMode = strictMode;
-    this.reduceSinkTagGenerator = 0;
   }
 
   static class OpAttr {
@@ -314,7 +310,12 @@ public class HiveOpConverter {
     // 3. Extract join keys from condition
     ExprNodeDesc[][] joinKeys = extractJoinKeys(joinPredInfo, joinRel.getInputs());
 
-    // 4. Generate Join operator
+    // 4.a Generate tags
+    for (int tag=0; tag<children.size(); tag++) {
+      ReduceSinkOperator reduceSinkOp = (ReduceSinkOperator) children.get(tag);
+      reduceSinkOp.getConf().setTag(tag);
+    }
+    // 4.b Generate Join operator
     JoinOperator joinOp = genJoin(joinRel, joinPredInfo, children, joinKeys);
 
     // 5. TODO: Extract condition for non-equi join elements (if any) and
@@ -331,7 +332,7 @@ public class HiveOpConverter {
       }
     }
 
-    // 8. Return result
+    // 7. Return result
     return new OpAttr(null, vcolMap, joinOp);
   }
 
@@ -394,7 +395,7 @@ public class HiveOpConverter {
 
       // 1.b. Generate reduce sink and project operator
       resultOp = genReduceSinkAndBacktrackSelect(resultOp,
-          sortCols.toArray(new ExprNodeDesc[sortCols.size()]), -1, new ArrayList<ExprNodeDesc>(),
+          sortCols.toArray(new ExprNodeDesc[sortCols.size()]), 0, new ArrayList<ExprNodeDesc>(),
           order.toString(), numReducers, Operation.NOT_ACID, strictMode);
     }
 
@@ -494,7 +495,7 @@ public class HiveOpConverter {
     }
 
     ReduceSinkOperator rsOp = genReduceSink(inputOpAf.inputs.get(0), expressions,
-        reduceSinkTagGenerator++, -1, Operation.NOT_ACID, strictMode);
+        -1, -1, Operation.NOT_ACID, strictMode);
 
     return inputOpAf.clone(rsOp);
   }
@@ -541,7 +542,7 @@ public class HiveOpConverter {
       }
 
       SelectOperator selectOp = genReduceSinkAndBacktrackSelect(input,
-          keyCols.toArray(new ExprNodeDesc[keyCols.size()]), reduceSinkTagGenerator++, partCols,
+          keyCols.toArray(new ExprNodeDesc[keyCols.size()]), 0, partCols,
           order.toString(), -1, Operation.NOT_ACID, strictMode);
 
       // 2. Finally create PTF



Mime
View raw message