yujun777 commented on code in PR #45310: URL: https://github.com/apache/doris/pull/45310#discussion_r1883403621
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/AddMinMax.java: ########## @@ -326,7 +326,10 @@ private Map<Expression, MinMaxValue> getExprMinMaxValues(UnknownValue valueDesc) for (int i = 1; i < sourceValues.size(); i++) { // process in sourceValues[i] Map<Expression, MinMaxValue> minMaxValues = getExprMinMaxValues(sourceValues.get(i)); - for (Map.Entry<Expression, MinMaxValue> entry : minMaxValues.entrySet()) { + List<Map.Entry<Expression, MinMaxValue>> minMaxValueList = minMaxValues.entrySet().stream() + .sorted((a, b) -> Integer.compare(a.getValue().exprOrderIndex, b.getValue().exprOrderIndex)) + .collect(Collectors.toList()); + for (Map.Entry<Expression, MinMaxValue> entry : minMaxValueList) { Review Comment: during mergging sourceValues[i] into result, we want to keep the relative order of values of sourceValues[i] if they don't in result. for example if a's exprOrderIndex < b's exprOrderIndex, then in result, a's new exprOrderIndex also < b's new exprOrderIndex. also add this comment in code. -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org