[
https://issues.apache.org/jira/browse/FLINK-23643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17441707#comment-17441707
]
liwei li commented on FLINK-23643:
----------------------------------
+1
> Support RANK() function for TopN
> --------------------------------
>
> Key: FLINK-23643
> URL: https://issues.apache.org/jira/browse/FLINK-23643
> Project: Flink
> Issue Type: New Feature
> Components: Table SQL / Planner
> Affects Versions: 1.12.0
> Reporter: YUJIANBO
> Priority: Major
>
> I found a problem that was fixed in 1.12.0 and FLINK-18440, but I repeated
> the same problem:
> ROW/RANGE not allowed with RANK, DENSE_RANK or ROW_NUMBER functions.
> this is my sql:
> ```
> create temporary view tmp as
> select
> area_zip,
> store_id,
> product_id,
> batch_id,
> RANK() over (PARTITION BY area_zip,store_id,product_id ORDER BY ts DESC
> RANGE BETWEEN INTERVAL '5' MINUTE preceding AND CURRENT ROW) AS num_rank
> from pricechangelogs;
> insert into print_table
> select * from tmp where num_rank = 1;
> ```
--
This message was sent by Atlassian Jira
(v8.20.1#820001)