morrySnow commented on code in PR #11264:
URL: https://github.com/apache/doris/pull/11264#discussion_r934119922
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -798,9 +799,10 @@ private Expression withPredicate(Expression
valueExpression, PredicateContext ct
break;
case DorisParser.IN:
if (ctx.query() == null) {
- //TODO: InPredicate
- outExpression = null;
- throw new IllegalStateException("Unsupported predicate
type: " + ctx.kind.getText());
+ outExpression = new InPredicate(
+ valueExpression,
+ withInList(ctx)
Review Comment:
nit: we need 8 indent
```suggestion
valueExpression,
withInList(ctx)
```
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/InPredicate.java:
##########
@@ -0,0 +1,99 @@
+// 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.expressions.visitor.ExpressionVisitor;
+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 compareExpr;
+ private List<Expression> optionsList;
Review Comment:
final
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -838,4 +840,10 @@ public Expression
visitSubqueryExpression(SubqueryExpressionContext subqueryExpr
public Expression visitExist(ExistContext context) {
return ParserUtils.withOrigin(context, () -> new
Exists(typedVisit(context.query())));
}
+
+ public List<Expression> withInList(PredicateContext ctx) {
+ List<Expression> expressions = ctx.expression().stream()
+ .map(expr ->
getExpression(expr)).collect(ImmutableList.toImmutableList());
+ return expressions;
Review Comment:
```suggestion
return ctx.expression().stream()
.map(this::getExpression).collect(ImmutableList.toImmutableList());
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]