You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/04/22 14:34:40 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #3357: disable some unsupported syntax

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org