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 2022/06/23 12:01:11 UTC

[GitHub] [doris] zhengshiJ opened a new pull request, #10377: [feature](nereids) Add brackets expr and ssbSql

zhengshiJ opened a new pull request, #10377:
URL: https://github.com/apache/doris/pull/10377

   # Proposed changes
   
   add brackets Expression.
   Add the sql required by ssb to prepare for subsequent verification
   
   ## Problem Summary:
   
   Describe the overview of changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (No/)
   2. Has unit tests been added: (Yes)
   3. Has document been added or modified: (No Need)
   4. Does it need to update dependencies: (No)
   5. Are there any changes that cannot be rolled back: (No)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] github-actions[bot] commented on pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10377:
URL: https://github.com/apache/doris/pull/10377#issuecomment-1167216361

   PR approved by anyone and no changes requested.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] zhengshiJ commented on a diff in pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
zhengshiJ commented on code in PR #10377:
URL: https://github.com/apache/doris/pull/10377#discussion_r905873731


##########
fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/ExpressionParserTest.java:
##########
@@ -134,4 +134,10 @@ public void testSortClause() throws Exception {
         String sort1 = "select a from test order by 1";
         assertSql(sort1);
     }
+
+    @Test
+    public void testBrackets() throws Exception {
+        String brackets = "select * from t1 where (a = 1) and (b = 1)";
+        assertSql(brackets);

Review Comment:
   done



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] yinzhijian commented on a diff in pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
yinzhijian commented on code in PR #10377:
URL: https://github.com/apache/doris/pull/10377#discussion_r909264832


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -567,13 +578,26 @@ public Expression withPredicate(PredicateContext ctx, Expression e) {
      * @return Expression
      */
     public Expression withBetween(PredicateContext ctx, Expression e) {
-        boolean isNotBetween = ctx.NOT() != null ? true : false;
         BetweenPredicate betweenPredicate = new BetweenPredicate(
                 e,
                 expression(ctx.lower),
                 expression(ctx.upper)
         );
-        return isNotBetween ? new Not(betweenPredicate) : betweenPredicate;
+        return betweenPredicate;

Review Comment:
   The variable betweenPredicate seems redundant and can be removed



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] morrySnow commented on a diff in pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
morrySnow commented on code in PR #10377:
URL: https://github.com/apache/doris/pull/10377#discussion_r905706956


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -562,6 +567,21 @@ public Expression withBetween(PredicateContext ctx, Expression e) {
         return isNotBetween ? new Not(betweenPredicate) : betweenPredicate;
     }
 
+    /**
+     * Generate In predicate.
+     *
+     * @param ctx PredicateContext
+     * @param e Expression
+     * @return Expression
+     */
+    public Expression withIn(PredicateContext ctx, Expression e) {
+        boolean isNotIn = ctx.NOT() != null ? true : false;

Review Comment:
   process NOT in withPredicate is better



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/InPredicate.java:
##########
@@ -0,0 +1,64 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions;
+
+import org.apache.doris.nereids.exceptions.UnboundException;
+import org.apache.doris.nereids.trees.NodeType;
+import org.apache.doris.nereids.types.BooleanType;
+import org.apache.doris.nereids.types.DataType;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * In Predicate Expression.
+ */
+public class InPredicate extends Expression {
+    private Expression compareExpression;
+    private List<Expression> inExpressions;
+
+    public InPredicate(Expression compareExpression, List<Expression> inExpressions) {
+        super(NodeType.IN,
+                (new Builder<Expression>().add(compareExpression).addAll(inExpressions)
+                        .build().toArray(new Expression[0])));
+        this.compareExpression = compareExpression;
+        this.inExpressions = ImmutableList.copyOf(Objects.requireNonNull(inExpressions, "in list can not be null"));
+    }
+
+    @Override
+    public DataType getDataType() throws UnboundException {
+        return BooleanType.INSTANCE;
+    }
+
+    @Override
+    public String sql() {
+        String sql = "";
+        for (Expression expression : inExpressions) {
+            sql += expression.sql();
+            sql += ", ";
+        }
+        return compareExpression.sql() + " IN " + sql;
+    }

Review Comment:
   return string is not a valid sql.
   ```suggestion
       public String sql() {
           return compareExpression.sql() + " IN " + expressions.stream()
                       .map(Expression::sql)
                       .collect(Collectors.joining(", ", "(", ")"));
       }
   ```



##########
fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/ExpressionParserTest.java:
##########
@@ -134,4 +134,10 @@ public void testSortClause() throws Exception {
         String sort1 = "select a from test order by 1";
         assertSql(sort1);
     }
+
+    @Test
+    public void testBrackets() throws Exception {
+        String brackets = "select * from t1 where (a = 1) and (b = 1)";
+        assertSql(brackets);

Review Comment:
   just notice print in assertXXX method, i think we should remove these print.



##########
fe/fe-core/src/test/java/org/apache/doris/nereids/SsbTest.java:
##########
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids;
+
+import org.apache.doris.nereids.parser.SqlParser;
+import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
+import org.apache.doris.utframe.TestWithFeService;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+public class SsbTest extends TestWithFeService {

Review Comment:
   do we need fe service to test parser?
   start a fe service is vary expensive.
   in Nereids's test, we should try to avoid to do that.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] zhengshiJ commented on a diff in pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
zhengshiJ commented on code in PR #10377:
URL: https://github.com/apache/doris/pull/10377#discussion_r905825843


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -562,6 +567,21 @@ public Expression withBetween(PredicateContext ctx, Expression e) {
         return isNotBetween ? new Not(betweenPredicate) : betweenPredicate;
     }
 
+    /**
+     * Generate In predicate.
+     *
+     * @param ctx PredicateContext
+     * @param e Expression
+     * @return Expression
+     */
+    public Expression withIn(PredicateContext ctx, Expression e) {
+        boolean isNotIn = ctx.NOT() != null ? true : false;

Review Comment:
   done



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/InPredicate.java:
##########
@@ -0,0 +1,64 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions;
+
+import org.apache.doris.nereids.exceptions.UnboundException;
+import org.apache.doris.nereids.trees.NodeType;
+import org.apache.doris.nereids.types.BooleanType;
+import org.apache.doris.nereids.types.DataType;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * In Predicate Expression.
+ */
+public class InPredicate extends Expression {
+    private Expression compareExpression;
+    private List<Expression> inExpressions;
+
+    public InPredicate(Expression compareExpression, List<Expression> inExpressions) {
+        super(NodeType.IN,
+                (new Builder<Expression>().add(compareExpression).addAll(inExpressions)
+                        .build().toArray(new Expression[0])));
+        this.compareExpression = compareExpression;
+        this.inExpressions = ImmutableList.copyOf(Objects.requireNonNull(inExpressions, "in list can not be null"));
+    }
+
+    @Override
+    public DataType getDataType() throws UnboundException {
+        return BooleanType.INSTANCE;
+    }
+
+    @Override
+    public String sql() {
+        String sql = "";
+        for (Expression expression : inExpressions) {
+            sql += expression.sql();
+            sql += ", ";
+        }
+        return compareExpression.sql() + " IN " + sql;
+    }

Review Comment:
   done



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] yinzhijian commented on a diff in pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
yinzhijian commented on code in PR #10377:
URL: https://github.com/apache/doris/pull/10377#discussion_r909264103


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -567,13 +578,26 @@ public Expression withPredicate(PredicateContext ctx, Expression e) {
      * @return Expression
      */
     public Expression withBetween(PredicateContext ctx, Expression e) {
-        boolean isNotBetween = ctx.NOT() != null ? true : false;
         BetweenPredicate betweenPredicate = new BetweenPredicate(
                 e,
                 expression(ctx.lower),
                 expression(ctx.upper)
         );
-        return isNotBetween ? new Not(betweenPredicate) : betweenPredicate;
+        return betweenPredicate;
+    }
+
+    /**
+     * Generate In predicate.
+     *
+     * @param ctx PredicateContext
+     * @param e Expression
+     * @return Expression
+     */
+    public Expression withIn(PredicateContext ctx, Expression e) {
+        List<Expression> expressions = ctx.expression().stream()
+                .map(expr -> expression(expr)).collect(ImmutableList.toImmutableList());
+        InPredicate inPredicate = new InPredicate(e, expressions);
+        return inPredicate;

Review Comment:
   ```suggestion
           return new InPredicate(e, expressions);
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] morrySnow commented on a diff in pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
morrySnow commented on code in PR #10377:
URL: https://github.com/apache/doris/pull/10377#discussion_r905908998


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/InPredicate.java:
##########
@@ -0,0 +1,70 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions;
+
+import org.apache.doris.nereids.exceptions.UnboundException;
+import org.apache.doris.nereids.trees.NodeType;
+import org.apache.doris.nereids.types.BooleanType;
+import org.apache.doris.nereids.types.DataType;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * In Predicate Expression.
+ */
+public class InPredicate extends Expression {
+    private Expression compareExpression;
+    private List<Expression> inExpressions;
+
+    public InPredicate(Expression compareExpression, List<Expression> inExpressions) {
+        super(NodeType.IN,
+                (new Builder<Expression>().add(compareExpression).addAll(inExpressions)
+                        .build().toArray(new Expression[0])));
+        this.compareExpression = compareExpression;
+        this.inExpressions = ImmutableList.copyOf(Objects.requireNonNull(inExpressions, "in list can not be null"));
+    }
+
+    @Override
+    public DataType getDataType() throws UnboundException {
+        return BooleanType.INSTANCE;
+    }
+
+    @Override
+    public String sql() {
+        return compareExpression.sql() + " IN (" + inExpressions.stream()

Review Comment:
   ```suggestion
           return compareExpression.sql() + " IN " + inExpressions.stream()
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -537,9 +540,15 @@ public Expression visitPredicated(PredicatedContext ctx) {
      * @return Expression
      */
     public Expression withPredicate(PredicateContext ctx, Expression e) {
+        boolean isNot = ctx.NOT() != null ? true : false;
+        Expression outExpression;
         switch (ctx.kind.getType()) {
             case DorisParser.BETWEEN:
-                return withBetween(ctx, e);
+                outExpression = withBetween(ctx, e);
+                return isNot ? new Not(outExpression) : outExpression;
+            case DorisParser.IN:
+                outExpression = withIn(ctx, e);
+                return isNot ? new Not(outExpression) : outExpression;
             default:
                 return null;

Review Comment:
   throw parse exception here, so we can do `return isNot ? new Not(outExpression) : outExpression;` at the end



##########
fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/ExpressionParserTest.java:
##########
@@ -25,18 +25,18 @@
 public class ExpressionParserTest {
     private static final SqlParser PARSER = new SqlParser();
 
-    private void assertSql(String sql) throws Exception {
+    private void assertSql(String sql) {
         TreeNode treeNode = PARSER.parse(sql);
-        System.out.println(treeNode.toString());
+        assert treeNode != null;

Review Comment:
   if you want to assert, it is better to use junit functions
   



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Not.java:
##########
@@ -64,7 +64,7 @@ public boolean equals(Object o) {
     }
 
     @Override
-    public String toString() {
-        return "( not " + child() + ")";
+    public String sql() {
+        return "( not " + child().sql() + ")";

Review Comment:
   ```suggestion
           return "( NOT " + child().sql() + ")";
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -537,11 +541,17 @@ public Expression visitPredicated(PredicatedContext ctx) {
      * @return Expression
      */
     public Expression withPredicate(PredicateContext ctx, Expression e) {
+        boolean isNot = ctx.NOT() != null ? true : false;
+        Expression outExpression;
         switch (ctx.kind.getType()) {
             case DorisParser.BETWEEN:
-                return withBetween(ctx, e);
+                outExpression = withBetween(ctx, e);
+                return isNot ? new Not(outExpression) : outExpression;
+            case DorisParser.IN:
+                outExpression = withIn(ctx, e);
+                return isNot ? new Not(outExpression) : outExpression;

Review Comment:
   we can move this statement to the end of this function and do not need process in each case



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] zhengshiJ commented on a diff in pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
zhengshiJ commented on code in PR #10377:
URL: https://github.com/apache/doris/pull/10377#discussion_r905997875


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -537,11 +541,17 @@ public Expression visitPredicated(PredicatedContext ctx) {
      * @return Expression
      */
     public Expression withPredicate(PredicateContext ctx, Expression e) {
+        boolean isNot = ctx.NOT() != null ? true : false;
+        Expression outExpression;
         switch (ctx.kind.getType()) {
             case DorisParser.BETWEEN:
-                return withBetween(ctx, e);
+                outExpression = withBetween(ctx, e);
+                return isNot ? new Not(outExpression) : outExpression;
+            case DorisParser.IN:
+                outExpression = withIn(ctx, e);
+                return isNot ? new Not(outExpression) : outExpression;

Review Comment:
   done



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/InPredicate.java:
##########
@@ -0,0 +1,70 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions;
+
+import org.apache.doris.nereids.exceptions.UnboundException;
+import org.apache.doris.nereids.trees.NodeType;
+import org.apache.doris.nereids.types.BooleanType;
+import org.apache.doris.nereids.types.DataType;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * In Predicate Expression.
+ */
+public class InPredicate extends Expression {
+    private Expression compareExpression;
+    private List<Expression> inExpressions;
+
+    public InPredicate(Expression compareExpression, List<Expression> inExpressions) {
+        super(NodeType.IN,
+                (new Builder<Expression>().add(compareExpression).addAll(inExpressions)
+                        .build().toArray(new Expression[0])));
+        this.compareExpression = compareExpression;
+        this.inExpressions = ImmutableList.copyOf(Objects.requireNonNull(inExpressions, "in list can not be null"));
+    }
+
+    @Override
+    public DataType getDataType() throws UnboundException {
+        return BooleanType.INSTANCE;
+    }
+
+    @Override
+    public String sql() {
+        return compareExpression.sql() + " IN (" + inExpressions.stream()

Review Comment:
   done



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Not.java:
##########
@@ -64,7 +64,7 @@ public boolean equals(Object o) {
     }
 
     @Override
-    public String toString() {
-        return "( not " + child() + ")";
+    public String sql() {
+        return "( not " + child().sql() + ")";

Review Comment:
   done



##########
fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/ExpressionParserTest.java:
##########
@@ -25,18 +25,18 @@
 public class ExpressionParserTest {
     private static final SqlParser PARSER = new SqlParser();
 
-    private void assertSql(String sql) throws Exception {
+    private void assertSql(String sql) {
         TreeNode treeNode = PARSER.parse(sql);
-        System.out.println(treeNode.toString());
+        assert treeNode != null;

Review Comment:
   done



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] zhengshiJ commented on a diff in pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
zhengshiJ commented on code in PR #10377:
URL: https://github.com/apache/doris/pull/10377#discussion_r905745316


##########
fe/fe-core/src/test/java/org/apache/doris/nereids/SsbTest.java:
##########
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids;
+
+import org.apache.doris.nereids.parser.SqlParser;
+import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
+import org.apache.doris.utframe.TestWithFeService;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+public class SsbTest extends TestWithFeService {

Review Comment:
   At present, only parser is done here, and other stages will be added to it in the future, and a TODO will be added, which will be more clear



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] zhengshiJ commented on a diff in pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
zhengshiJ commented on code in PR #10377:
URL: https://github.com/apache/doris/pull/10377#discussion_r905873875


##########
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4:
##########
@@ -196,6 +196,7 @@ primaryExpression
     | LEFT_PAREN query RIGHT_PAREN                                                             #subqueryExpression
     | identifier                                                                               #columnReference
     | base=primaryExpression DOT fieldName=identifier                                          #dereference
+    | '(' expression ')'                                                                       #parenthesizedExpression

Review Comment:
   done



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] morrySnow commented on a diff in pull request #10377: [feature](nereids) Add brackets expr and ssbSql

Posted by GitBox <gi...@apache.org>.
morrySnow commented on code in PR #10377:
URL: https://github.com/apache/doris/pull/10377#discussion_r905134514


##########
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4:
##########
@@ -196,6 +196,7 @@ primaryExpression
     | LEFT_PAREN query RIGHT_PAREN                                                             #subqueryExpression
     | identifier                                                                               #columnReference
     | base=primaryExpression DOT fieldName=identifier                                          #dereference
+    | '(' expression ')'                                                                       #parenthesizedExpression

Review Comment:
   line 196 use `LEFT_PAREN`, so we should use one thing to represent left parenthesis in all place



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] EmmyMiao87 commented on pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on PR #10377:
URL: https://github.com/apache/doris/pull/10377#issuecomment-1174771282

   Most of the content of this pr has been implemented in the master code, except for the in predicate.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [doris] EmmyMiao87 closed pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 closed pull request #10377: [feature](nereids) Add brackets expr and ssbSql and inPredicate Expr
URL: https://github.com/apache/doris/pull/10377


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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