问题
ksql> CREATE TABLE HOPPING_TABLE AS SELECT ID, WINDOWSTART() AS WINSTART, COUNT(*) AS CNT FROM MY_STREAM HOPPING WINDOW (SIZE 30 DAYS, ADVANCED BY 1 DAYS) GROUP BY ID;
ksql> SELECT ID, WINSTART, CNT FROM HOPPING_TABLE;
id winstart cnt
-------------------------------------------
874163197805291909 1547164800000 23
874163197805291909 1547424000000 11
874163197805291909 1547510400000 26
874163197805291909 1547683200000 12
660071199310134801 1545868800000 6
660071199310134801 1546560000000 7
660071199310134801 1547251200000 3
Now, I just care about the cnt of window with max winstart value for each ID
grouped, how to achieve that by KSQL then?
Considering above example (2 IDs grouped), I hope a table can be generated from above HOPPING TABLE with the following records:
id winstart cnt
-------------------------------------------
874163197805291909 1547683200000 12
660071199310134801 1547251200000 3
来源:https://stackoverflow.com/questions/54232400/in-ksql-how-to-select-max-window-record-after-windowing-and-group-by