[ https://issues.apache.org/jira/browse/HIVE-27507?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zhizhen Hou updated HIVE-27507: ------------------------------- Description: Now, the hasOuterJoin returns whether the last join condition is outer join. If hast join condition is not outer join, it returns false reglardless there is outer join. {code:java} private boolean hasOuterJoin(JoinOperator joinOp) throws SemanticException { boolean hasOuter = false; for (JoinCondDesc joinCondDesc : joinOp.getConf().getConds()) { switch (joinCondDesc.getType()) { case JoinDesc.INNER_JOIN: case JoinDesc.LEFT_SEMI_JOIN: case JoinDesc.UNIQUE_JOIN: hasOuter = false; break; case JoinDesc.FULL_OUTER_JOIN: case JoinDesc.LEFT_OUTER_JOIN: case JoinDesc.RIGHT_OUTER_JOIN: hasOuter = true; break; default: throw new SemanticException("Unknown join type " + joinCondDesc.getType()); } } return hasOuter; } {code} There may be two solutions. 1. Short circuit if found outer join and return true; 2. Delete 'hasOuter = false;' if join type is not outer join and loop through all join conditions. > ConvertJoinMapJoin#hasOuterJoin produce incorrect result > -------------------------------------------------------- > > Key: HIVE-27507 > URL: https://issues.apache.org/jira/browse/HIVE-27507 > Project: Hive > Issue Type: Bug > Components: Query Planning > Reporter: Zhizhen Hou > Assignee: Zhizhen Hou > Priority: Major > > Now, the hasOuterJoin returns whether the last join condition is outer join. > If hast join condition is not outer join, it returns false reglardless there > is outer join. > {code:java} > private boolean hasOuterJoin(JoinOperator joinOp) throws SemanticException { > boolean hasOuter = false; > for (JoinCondDesc joinCondDesc : joinOp.getConf().getConds()) { > switch (joinCondDesc.getType()) { > case JoinDesc.INNER_JOIN: > case JoinDesc.LEFT_SEMI_JOIN: > case JoinDesc.UNIQUE_JOIN: > hasOuter = false; > break; > case JoinDesc.FULL_OUTER_JOIN: > case JoinDesc.LEFT_OUTER_JOIN: > case JoinDesc.RIGHT_OUTER_JOIN: > hasOuter = true; > break; > default: > throw new SemanticException("Unknown join type " + > joinCondDesc.getType()); > } > } > return hasOuter; > } {code} > There may be two solutions. > 1. Short circuit if found outer join and return true; > 2. Delete 'hasOuter = false;' if join type is not outer join and loop through > all join conditions. -- This message was sent by Atlassian Jira (v8.20.10#820010)