问题描述
如果我使用EMIT CHANGES",我会在 ksqldb 上进行以下查询;它确实有效,但如果将其更改为EMIT FINAL"窗口结束后不返回任何值
I've following query on ksqldb , if I use "EMIT CHANGES" it does work, but if change it to "EMIT FINAL" it does not return any value after the window end
CREATE TABLE sspc_3536660_v4 as select sspc,
>LATEST_BY_OFFSET(CASE WHEN metric ='sspc_ds_cir_fulfillment' THEN value ELSE NULL END)AS sspc_ds_cir_fulfillment,
>LATEST_BY_OFFSET(CASE WHEN metric ='sspc_ds_cir_current' THEN value ELSE NULL END )AS sspc_ds_cir_current,
>LATEST_BY_OFFSET(CASE WHEN metric ='sspc_ds_cir_fulfillment_ratio' THEN value ELSE NULL END)AS sspc_ds_cir_fulfillment_ratio,
>LATEST_BY_OFFSET(CASE WHEN metric ='sspc_ds_cir_demand_bytes' THEN value ELSE NULL END )AS sspc_ds_cir_demand_bytes,
>LATEST_BY_OFFSET(CASE WHEN metric ='sspc_us_cir_fulfillment_ratio' THEN value ELSE NULL END)AS sspc_us_cir_fulfillment_ratio,
>LATEST_BY_OFFSET(CASE WHEN metric ='sspc_ds_cir_demand_kbps' THEN value ELSE NULL END )AS sspc_ds_cir_demand_kbps,
>LATEST_BY_OFFSET(CASE WHEN metric ='sspc_us_cir_demand_kbps' THEN value ELSE NULL END)AS sspc_us_cir_demand_kbps,
>LATEST_BY_OFFSET(CASE WHEN metric ='sspc_us_cir_fulfillment' THEN value ELSE NULL END )AS sspc_us_cir_fulfillment,
>LATEST_BY_OFFSET(CASE WHEN metric ='sspc_us_cir_demand_bytes' THEN value ELSE NULL END )AS sspc_us_cir_demand_bytes,
>LATEST_BY_OFFSET(CASE WHEN metric ='sspc_us_cir_current' THEN value ELSE NULL END)AS sspc_us_cir_current,
>count(*) as ct
>from Sspc_Usage_Stats_Transposedv3
>WINDOW TUMBLING (SIZE 5 MINUTES , GRACE PERIOD 1 MINUTES ) where sspc=3536660
>group by sspc emit final ;
谁能给个提示?
推荐答案
EMIT FINAL
是数据驱动的,即只有当stream-time"提前超过窗口关闭时间.流时间"取决于观察到的输入记录的时间戳,因此,如果您停止发送输入记录,stream-time"没有进一步发展.
EMIT FINAL
is data driven, i.e., it emit results only if "stream-time" advanced beyond the window close time. "Stream-time" depends on the observed timestamps of your input record, and thus, if you stop sending input records, "stream-time" does not advance further.
因此,如果您停止发送数据,最后一个窗口可能永远不会关闭,因此您永远不会看到它的结果.
Thus, if you stop sending data, the last window might never be closed, and thus you never see a result for it.
这篇关于KSQLDB Emit Final 不返回任何值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!