diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/HiveOpConverter.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/HiveOpConverter.java index 1a1fe91..b1b5375 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/HiveOpConverter.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/HiveOpConverter.java @@ -994,7 +994,7 @@ private static JoinOperator genJoin(RelNode join, ExprNodeDesc[][] joinExpressio * to be expressed that way. */ private static int updateExprNode(ExprNodeDesc expr, final Map reversedExprs, - final Map colExprMap) { + final Map colExprMap) throws SemanticException { int inputPos = -1; if (expr instanceof ExprNodeGenericFuncDesc) { ExprNodeGenericFuncDesc func = (ExprNodeGenericFuncDesc) expr; @@ -1002,10 +1002,26 @@ private static int updateExprNode(ExprNodeDesc expr, final Map rev for (ExprNodeDesc functionChild : func.getChildren()) { if (functionChild instanceof ExprNodeColumnDesc) { String colRef = functionChild.getExprString(); - inputPos = reversedExprs.get(colRef); + int pos = reversedExprs.get(colRef); + if (pos != -1) { + if (inputPos == -1) { + inputPos = pos; + } else if (inputPos != pos) { + throw new SemanticException( + "UpdateExprNode is expecting only one position for join operator convert. But there are more than one."); + } + } newChildren.add(colExprMap.get(colRef)); } else { - inputPos = updateExprNode(functionChild, reversedExprs, colExprMap); + int pos = updateExprNode(functionChild, reversedExprs, colExprMap); + if (pos != -1) { + if (inputPos == -1) { + inputPos = pos; + } else if (inputPos != pos) { + throw new SemanticException( + "UpdateExprNode is expecting only one position for join operator convert. But there are more than one."); + } + } newChildren.add(functionChild); } }