punya opened a new issue, #27686: URL: https://github.com/apache/datafusion/issues/27686
### Describe the bug A window function in `|> ORDER BY` fails. A normal `ORDER BY` accepts window functions. ### To Reproduce ```sql CREATE TABLE t AS SELECT * FROM (VALUES (1, 10), (1, 20), (2, 30)) AS t(k, v); SELECT * FROM t |> ORDER BY row_number() OVER (ORDER BY v DESC); ``` ``` Error during planning: Window function 'row_number() ORDER BY [t.v DESC NULLS FIRST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW' is not supported in this position. Window functions are supported in the SELECT list, ORDER BY, DISTINCT ON and QUALIFY ``` Without pipes, this works: ```sql SELECT * FROM t ORDER BY row_number() OVER (ORDER BY v DESC); ``` ### Expected behavior Rows ordered `(2, 30)`, `(1, 20)`, `(1, 10)`, with the output columns unchanged (`k`, `v`). ### Additional context Same cause as #27680: the pipe operator builds the sort directly and skips the window planning a normal `ORDER BY` gets. 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]
