hassaanch23 commented on code in PR #25402: URL: https://github.com/apache/datafusion/pull/25402#discussion_r4037534353
########## datafusion/sqllogictest/test_files/group_by.slt: ########## @@ -3075,6 +3075,21 @@ FRA 50 200 GRC 30 80 TUR 75 100 +# An ORDER BY on an order-insensitive aggregator is ignored, so its partial +# state must not include ordering fields. MIN and MAX use the default state +# fields; SUM is a control that already defines its own. +query TRRR +SELECT country, MIN(amount ORDER BY ts DESC) AS min1, + MAX(amount ORDER BY ts DESC) AS max1, + SUM(amount ORDER BY ts DESC) AS sum1 + FROM sales_global + GROUP BY country + ORDER BY country Review Comment: You're right that it isn't specific to grouped queries, but that exact query passes on `main`. `sales_global` is a single partition, so the aggregate runs in `Single` mode and never builds a partial state. With `WHERE amount > 0` the input becomes multi-partition, the plan becomes `Partial` → `Final`, and on `main` it fails with `number of columns(3) must match number of fields(5) in schema`. I added that version, with `SUM` as a control. It fails without the fix and passes with it. -- 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]
