StreamPhysicalWindowAggregate 不支持消费更新和删除更改

StreamPhysicalWindowAggregate doesn't support consuming update and delete changes

de

t_window 是 cdc table。

sql:

select organization_id,window_start,window_end,count(1) as cnt
from TABLE(TUMBLE(TABLE t_window,descriptor(took_at),interval '1' days))
group by organization_id,window_start,window_end;

错误:

org.apache.flink.table.api.TableException:StreamPhysicalWindowAggregate 不支持使用节点 TableSourceScan 产生的更新和删除更改(table=[[emr_hive,默认,t_window] ], fields=[id, organization_id, took_at]).

请帮忙!

我认为 Flink 的 window table-valued 函数不支持包含撤回(更新和删除)的输入——它们只支持 append-only 流。另一方面,GROUP BY windows 确实支持这一点,但仅限于 Flink 1.14.

所以我建议你转换成这样的查询

select
  organization_id,
  TUMBLE_START(took_at, interval '1' hour),
  TUMBLE_END(took_at, interval '1' hour),
  count(1) as cnt
from t_window
group by organization_id, TUMBLE(took_at, interval '1' hour);

如果您还没有使用 Flink 1.14,请升级到它。

有关详细信息,请参阅 https://issues.apache.org/jira/browse/FLINK-20487