morningman commented on a change in pull request #3357: URL: https://github.com/apache/incubator-doris/pull/3357#discussion_r413035997
########## File path: fe/src/main/java/org/apache/doris/analysis/SelectStmt.java ########## @@ -1362,9 +1362,24 @@ private void rewriteSelectList(ExprRewriter rewriter) throws AnalysisException { if (!item.getExpr().contains(Predicates.instanceOf(Subquery.class))) { continue; } + CaseExpr caseExpr = (CaseExpr) item.getExpr(); + + int childIdx = 0; + if (caseExpr.hasCaseExpr() + && caseExpr.getChild(childIdx++).contains(Predicates.instanceOf(Subquery.class))) { + throw new AnalysisException("Only support subquery in binary predicate in case statement."); + } + while (childIdx + 2 <= caseExpr.getChildren().size()) { + Expr child = caseExpr.getChild(childIdx++); + // case Review comment: `caseExpr.getChild(childIdx++)` here you got the `when` expr ########## File path: fe/src/main/java/org/apache/doris/analysis/SelectStmt.java ########## @@ -1362,9 +1362,24 @@ private void rewriteSelectList(ExprRewriter rewriter) throws AnalysisException { if (!item.getExpr().contains(Predicates.instanceOf(Subquery.class))) { continue; } + CaseExpr caseExpr = (CaseExpr) item.getExpr(); + + int childIdx = 0; + if (caseExpr.hasCaseExpr() + && caseExpr.getChild(childIdx++).contains(Predicates.instanceOf(Subquery.class))) { + throw new AnalysisException("Only support subquery in binary predicate in case statement."); + } + while (childIdx + 2 <= caseExpr.getChildren().size()) { + Expr child = caseExpr.getChild(childIdx++); + // case + if (!(child instanceof BinaryPredicate) && child.contains(Predicates.instanceOf(Subquery.class))) { + throw new AnalysisException("Only support subquery in binary predicate in case statement."); + } + // when Review comment: Here is to skip `then` expr, not `when` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org