englefly commented on code in PR #24680:
URL: https://github.com/apache/doris/pull/24680#discussion_r1333851153


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyInPredicate.java:
##########
@@ -46,12 +47,25 @@ public Expression visitInPredicate(InPredicate expr, 
ExpressionRewriteContext co
                     List<Expression> literals = expr.children().subList(1, 
expr.children().size());
                     if (literals.stream().allMatch(literal -> literal 
instanceof DateTimeV2Literal
                             && 
canLosslessConvertToDateV2Literal((DateTimeV2Literal) literal))) {
-                        List<Expression> children = Lists.newArrayList();
+                        ImmutableList.Builder<Expression> children = 
ImmutableList.builder();
                         children.add(cast.child());
-                        literals.stream().forEach(
-                                l -> 
children.add(convertToDateV2Literal((DateTimeV2Literal) l)));
-                        return expr.withChildren(children);
+                        literals.forEach(l -> 
children.add(convertToDateV2Literal((DateTimeV2Literal) l)));
+                        return expr.withChildren(children.build());
                     }
+                } else if (cast.child().getDataType().isDateTimeV2Type()

Review Comment:
   cast(A as xxx) in (opt1, opt2, ...)
   if A is DatetimeV2 type, and opt1 is DateTimeV2Literal, why there is a cast?



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

Reply via email to