问题1: 使用 over window 聚合,发现同一个时间窗口会产生多条数据 ?

ANS: Over Window 的开窗模式是每条数据过来会产生一个新的窗口,并不会删除原来的窗口产生的数据, 如果要保证每个时间窗口的数据只有一条, 应该使用 group window


问题2: 在 FlinkSQL 中使用 Hive 作为维表时,报错: The only supported ‘streaming-source.partition.include’ is ‘all’ in hive table scan, but is ’latest’)

ANS: SQL 写法的问题, 当使用 latest 时,必须要使用 temporal join 的写法, 如果使用了普通的 join,或者使用了子查询, Hive 表实际会当作一个 source 表,因此无法支持 latest 的选项


ANS:

  1. Flink SQL 中提供了 collect 函数用于聚合
  2. 可以使用 hive module, 使用 hive 函数直接引用即可

问题4: 使用 Hive 维度表,非常容易 OOM,实际的维度表可能就几十 M

ANS:

  1. Hive 的 Parquet 文件时经过压缩的, 实际加载到内存,可能远比文件要大的多。