twalthr commented on code in PR #24256: URL: https://github.com/apache/flink/pull/24256#discussion_r1852228055
########## docs/content.zh/docs/dev/table/sql/queries/deduplication.md: ########## @@ -32,13 +32,10 @@ Flink 使用 `ROW_NUMBER()` 去除重复数据,就像 Top-N 查询一样。其 下面的例子展示了去重语句的语法: ```sql -SELECT [column_list] -FROM ( - SELECT [column_list], - ROW_NUMBER() OVER ([PARTITION BY col1[, col2...]] - ORDER BY time_attr [asc|desc]) AS rownum - FROM table_name) -WHERE rownum = 1 +SELECT [column_list], Review Comment: Can we use this instead for deduplication? The Top-N makes sense. ``` SELECT [column_list] FROM table_name QUALIFY ROW_NUMBER() OVER ([PARTITION BY col1[, col2...]] ORDER BY time_attr [asc|desc]) = 1 ``` ########## docs/content/docs/dev/table/concepts/versioned_tables.md: ########## @@ -163,13 +163,10 @@ table usable in subsequent queries. In general, the results of a query with the following format produces a versioned table: ```sql -SELECT [column_list] -FROM ( - SELECT [column_list], - ROW_NUMBER() OVER ([PARTITION BY col1[, col2...]] - ORDER BY time_attr DESC) AS rownum - FROM table_name) -WHERE rownum = 1 +SELECT [column_list], + ROW_NUMBER() OVER ([PARTITION BY col1[, col2...]] ORDER BY time_attr [asc|desc]) AS rownum +FROM table_name) +QUALIFY rownum = 1 Review Comment: use same as for dedup ########## docs/content.zh/docs/dev/table/sql/queries/topn.md: ########## @@ -32,13 +32,11 @@ Flink 使用 `OVER` 窗口子句和过滤条件的组合来表达一个 Top-N 下面展示了 Top-N 的语法: ```sql -SELECT [column_list] -FROM ( - SELECT [column_list], - ROW_NUMBER() OVER ([PARTITION BY col1[, col2...]] - ORDER BY col1 [asc|desc][, col2 [asc|desc]...]) AS rownum - FROM table_name) -WHERE rownum <= N [AND conditions] +SELECT [column_list], + ROW_NUMBER() OVER ([PARTITION BY col1[, col2...]] ORDER BY time_attr [asc|desc]) AS rownum +FROM table_name) Review Comment: ``` FROM table_name ``` -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org