问题描述
我需要从 tableA 中获取大于 cdc_date 的所有记录,该记录存储在另一个 tmp_table 中
tmp_table 只有一列 cdc_date 和只有一条记录。
tableA 有超过 500 万条记录。
我的 Hive 查询
number
我收到以下错误
Select count(*) from tableA as a
where unix_timestamp((concat_ws('-',a.year,a.month,a.day,a.hour)),"yyyy-MM-dd-HH") >
(select b.cdc_date from tmp_table as b)
谁能建议如何激活它。
解决方法
你需要重写sql -
Select count(*) from tableA as a
Left join tmp_table b
On unix_timestamp((concat_ws('-',a.year,a.month,a.day,a.hour)),"yyyy-MM-dd-HH") >
b.cdc_date
,
与单行表交叉连接:
Select count(*)
from tableA as a
cross join tmp_table b
where unix_timestamp((concat_ws('-',"yyyy-MM-dd-HH") > b.cdc_date