Hi! 会将 input 的记录存储在 state 里面。
如果 input 的字段比较多,但是参与聚合运算的字段比较少。 这样会导致 state 非常的大。 > 你使用的是哪个 Flink 版本以及哪个 planner?这个观察是如何得出的呢?就我所知,state 里应该只存储了参与 agg 运算的字段。 Tianwang Li <[email protected]> 于2021年10月19日周二 下午8:34写道: > Flink 的 Over 窗口 > 例如在 range over window 场合,会将 input 的记录存储在 state 里面。 > 如果 input 的字段比较多,但是参与聚合运算的字段比较少。 > 这样会导致 state 非常的大。 > > 从 RowTimeRangeBoundedPrecedingFunction 里面逻辑看, > 不参与agg运算的字段,在 onTimer 时期输出之后,是可以清理了的。 > > 这样能提升Over 窗口的处理性能吗? > > SQL例子: > > SELECT > col_1, > col_2, > col_3, > col_4, > col_5, > col_6, -- 字段内容比较长 > col_7, -- 字段内容比较长 > col_8, -- 字段内容比较长 > col_9, -- 字段内容比较长 > col_10, > col_11, > col_12, > col_13, > col_14, > col_15, > col_16, > col_17, > col_18, > col_19, > sum(col_10) OVER w AS day_col_10, > sum(col_11) OVER w AS day_col_11, > sum(col_12) OVER w AS day_col_12, > sum(col_13) OVER w AS day_col_13, > sum(col_14) OVER w AS day_col_14, > sum(col_15) OVER w AS day_col_15, > sum(col_16) OVER w AS day_col_16 > FROM table_3 > window w as ( > PARTITION BY col_1, col_2 > ORDER BY rowtime > RANGE BETWEEN INTERVAL '1' DAY preceding AND CURRENT ROW) > > -- > ************************************** > tivanli > ************************************** >
