morrySnow commented on code in PR #47829:
URL: https://github.com/apache/doris/pull/47829#discussion_r1952277717


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyRange.java:
##########
@@ -231,10 +230,12 @@ public static ValueDesc union(ExpressionRewriteContext 
context,
         public abstract ValueDesc intersect(ValueDesc other);
 
         public static ValueDesc intersect(ExpressionRewriteContext context, 
RangeValue range, DiscreteValue discrete) {
-            DiscreteValue result = new DiscreteValue(context, 
discrete.reference, discrete.toExpr);
-            discrete.values.stream().filter(x -> 
range.range.contains(x)).forEach(result.values::add);
-            if (!result.values.isEmpty()) {
-                return result;
+            Set<Literal> newValues = discrete.values.stream()
+                    .filter(x -> range.range.contains(x))
+                    .collect(Collectors.toCollection(
+                            () -> 
Sets.newLinkedHashSetWithExpectedSize(discrete.values.size())));

Review Comment:
   Add comments to make it clear why LinkedHashSet is necessary here.



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