You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by macia kk <pr...@gmail.com> on 2021/03/15 10:55:35 UTC

Flink Temporal Join Two union Hive Table Error

Hi, 麻烦帮忙看下这个问题:


创建 View promotionTable:

SELECT *, 'CN' as country, id as pid FROM promotion_cn_rule_tab UNION
SELECT *, 'JP' as country, id as pid FROM promotion_jp_rule_tab

FLink SQL Query:
SELECT t1.country, t1.promotionId, t1.orderId, CASE WHEN t2.pid IS NULL
THEN 'Rebate' ELSE 'Rebate' END AS rebate FROM eventTable AS t1 LEFT JOIN
promotionTable /*+ OPTIONS('streaming-source.enable' = 'false',
'streaming-source.partition.include' = 'all', 'lookup.join.cache.ttl' = '5
m') */ FOR SYSTEM_TIME AS OF t1.procTime AS t2 ON t1.promotionId = t2.pid
AND t1.country = t2.country


如果去掉 Hive 表的 union ,只保留一个国家的 Hive 表,可以run 成功,但是如果 Union 两张表的话,会得到错误:

Caused by: org.apache.flink.table.api.ValidationException: Currently the
join key in Temporal Table Join can not be empty