diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConvertJoinMapJoin.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConvertJoinMapJoin.java index e3b293a..93e3631 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConvertJoinMapJoin.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConvertJoinMapJoin.java @@ -766,7 +766,11 @@ public MapJoinOperator convertJoinMapJoin(JoinOperator joinOp, OptimizeTezProcCo } // Remove semijoin Op if there is any. - if (context.parseContext.getRsOpToTsOpMap().size() > 0) { + // The semijoin branch can potentially create a task level cycle + // with the hashjoin except when it is dynamically partitioned hash + // join which takes place in a separate task. + if (context.parseContext.getRsOpToTsOpMap().size() > 0 + && removeReduceSink) { removeCycleCreatingSemiJoinOps(mapJoinOp, parentSelectOpOfBigTableOp, context.parseContext); }