jayzhan211 opened a new issue, #15485: URL: https://github.com/apache/datafusion/issues/15485
### Is your feature request related to a problem or challenge? The QUALIFY clause is used to filter the results of [WINDOW functions](https://duckdb.org/docs/stable/sql/functions/window_functions.html). This filtering of results is similar to how a [HAVING clause](https://duckdb.org/docs/stable/sql/query_syntax/having.html) filters the results of aggregate functions applied based on the [GROUP BY clause](https://duckdb.org/docs/stable/sql/query_syntax/groupby.html) I think this syntax helps us to have a simpler syntax without subquery or with clause, similar to the benefit of `having` clause to aggregation function. ``` statement count 0 create table t(id int, region int) as values (1, 2), (3, 4), (5, 6), (4, 4); query I select row_number() over (PARTITION BY region) as rk from t; ---- 1 1 2 1 query I with ranked as ( select row_number() over (PARTITION BY region) as rk from t ) select * from ranked where rk > 1; ---- 2 query error DataFusion error: This feature is not implemented: QUALIFY select row_number() over (PARTITION BY region) as rk from t qualify rk > 1; ``` ### Describe the solution you'd like Support QUALIFY syntax for window function ### Describe alternatives you've considered Use subquery and with clause ### Additional context https://duckdb.org/docs/stable/sql/query_syntax/qualify.html -- 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: github-unsubscr...@datafusion.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org