punya opened a new issue, #27684: URL: https://github.com/apache/datafusion/issues/27684
### Describe the bug `|> AGGREGATE` accepts `ASC`/`DESC` on its aggregate and `GROUP BY` items but ignores them. The query runs and returns rows in arbitrary order, with no error. ### To Reproduce ```sql CREATE TABLE u AS SELECT * FROM (VALUES (3, 1), (1, 2), (2, 3)) AS u(k, v); SELECT * FROM u |> AGGREGATE sum(v) AS s GROUP BY k DESC; ``` ``` k,s 1,2 3,1 2,3 ``` The order changes from run to run, and `GROUP BY k ASC` behaves the same way. `EXPLAIN` shows no sort, only the aggregate. The planner reads `ExprWithAliasAndOrderBy.expr` and drops `.order_by`. ### Expected behavior In BigQuery's [pipe syntax](https://cloud.google.com/bigquery/docs/reference/standard-sql/pipe-syntax#aggregate_pipe_operator), ordering suffixes on `AGGREGATE` items order the output. `GROUP BY k DESC` should return `3,1 / 2,3 / 1,2`. If ordering is not supported yet, the query should fail with a not-implemented error instead of ignoring it. ### Additional context Found while fixing #27680 and #27681. Part of #14660. -- 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]
