morrySnow opened a new pull request, #36057: URL: https://github.com/apache/doris/pull/36057
pick from master #35899 This PR 1. support distinct project + aggregate: for sql like: SELECT DISTINCT c1 FROM t GROUP BY c1, c2 should do distinct c1 after group by c1 and c2. the plan should be: Project(isDistinct=true, [c1]) +-- Aggregate(groupByKey=[c1, c2], output=[c1]) but we lost distinct project with: Aggregate(groupByKey=[c1, c2], output=[c1]) the result is wrong because c1 do not DISTINCT at all 2. fix repeat column pruning bug prune grouping set columns for sql like: select a1, sum(sid) from ( select a + 1 as a1, b + 1 as b1, sum(id) as sid from t group by grouping sets( ( a + 1, b ), (b + 1), (b + 2), (b + 3) ) ) t group by a1; exception will be raised: Caused by: java.util.NoSuchElementException: No value present at java.util.Optional.get(Optional.java:143) ~[?:?] at org.apache.doris.nereids.trees.plans.algebra.Repeat.getSortedVirtualSlots(Repeat.java:101) ~[classes/:?] at org.apache.doris.nereids.glue.translator.PhysicalPlanTranslator.visitPhysicalRepeat(PhysicalPlanTranslator.java:2212) ~[classes/:?] that because virtual column COL_GROUPING_ID be prune by mistake ## Proposed changes Issue Number: close #xxx <!--Describe your changes.--> -- 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