Posted by Lu Weizheng on URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Get-Tumbling-Window-Top-K-using-SQL-tp33236p33259.html
Sorry guys,
I find solution on wiki about Top-N using Blink planner.
The main idea is using a RANK to get the Top K of filed 'a':
SELECT a, b, c
FROM (
SELECT
a, b, c,
RANK() OVER (ORDER BY a PARTITION BY CEIL(t TO MINUTE) BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as rank
FROM yourTable)
WHERE rank <= 10
is there better way to get tumbling window Top-K item now?