Hi team, I have a basic question about Window Top-...
# troubleshooting
w
Hi team, I have a basic question about Window Top-N, the document said "window Top-N purges all intermediate state _*`when no longer needed`*_", but how to control the window size? It seems that Flink
1.18
can run form the execution plan, however tuning Top-N state is not supported. For example for a detailed case: How to deduplicate the logs using Top-N (Top-1) for only 1 hour? The example query on the doc: https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/dev/table/sql/queries/window-deduplication/
Copy code
SELECT [column_list]
FROM (
   SELECT [column_list],
     ROW_NUMBER() OVER (PARTITION BY window_start, window_end [, col_key1...]
       ORDER BY time_attr [asc|desc]) AS rownum
   FROM table_name) -- relation applied windowing TVF
WHERE (rownum = 1 | rownum <=1 | rownum < 2) [AND conditions]
Many thanks.
I'm still looking at it, but i think i can use
rows between interval '1' hour preceding and current row
to limit the state size.
d
Did this work for you?
w
Hi there, no. The regular deduplication did not work in my case (I can not control the state size). I'm now explore to use window-deduplication, the state size was confirmed stable however this approach could not support session-window yet.
d
I also need to do top-N, but from a CDC source and I think the Top-N doesn't support this at the moment
w
The regular deduplication did not work in my case (I can not control the state size).
Oh I hit an error that,
row_number()
can not work together with
rows
and
range
.
d
Seems similar
I will try windowing the query tomorrow as well
w
FYI: I'm asking the same question in Confluent Community flink channel as well. https://confluentcommunity.slack.com/archives/C05T5F96UQ7/p1705141115176469
d
I don't think I have access to that
w
I will try windowing the query tomorrow as well
Could you keep me posted if you manage to solve this?
I don't think I have access to that
It's a public slack, everyone can join. But I'll also keep you updated.
d
ah, ok
gratitude thank you 1