Flinksql bug : Temporal table join requires an equality condition on fields of table

在使用Flink SQL进行维表关联时遇到错误:Temporal table join需要等值条件。错误出现在特定的流式join操作与Hive表关联的场景。解决方案是确保关联条件为等号连接,且两侧数据类型一致。然而,实践中发现,即使对数字内容的字符串字段进行类型转换(如cast(cast(field as bigint) as string)),也会导致错误。正确的做法是将int类型字段直接cast为string,然后与string类型字段进行关联。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错信息

org.apache.flink.table.api.TableException: Temporal table join requires an equality condition on fields of table *******************

发生地址

flinksql 与维表关联场景 包括hive的流式join

解决

关联条件必须等值关联 也就是必须是等号,并且 关联条件两边要确定数据类型相同

实测

如果关联条件都是字符串,内容是数字,两测都强制类型转换,cast(feild as bigint) 会报错。很奇怪 做了强制类型转换反而报错了
不支持 已经是int的类型 再次cast(int类型字段 as int) 与 cast(string类型字段 as int) 做关联 必须 string类型字段 = cast(int类型字段 as string) 这么做

报错!!!!
left join  hive_zjyprc_hadoop.china_bi.dim_sku_great_bargains /*+ OPTIONS('streaming-source.enable' = 'true','streaming-source.partition.include' = 'latest',
            'streaming-source.partition-order' = 'create-time','streaming-source.monitor-interval' = '1 h') */
             FOR SYSTEM_TIME AS OF w.proctime AS w3  on cast(w.category_id as bigint) = cast(w3.virtual_category_id as bigint)
正确!!!            left join  hive_zjyprc_hadoop.china_bi.dim_sku_great_bargains /*+ OPTIONS('streaming-source.enable' = 'true','streaming-source.partition.include' = 'latest',
            'streaming-source.partition-order' = 'create-time','streaming-source.monitor-interval' = '1 h') */
             FOR SYSTEM_TIME AS OF w.proctime AS w3  on w.category_id = cast(w3.virtual_category_id

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Direction_Wind

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值