首页 > 解决方案 > 验证 dB1.table1 数据元素是否在 dB2.table2 中正确地从 UTC 转换为 EST

问题描述

必须验证 db1.table.a_timestamp 中的 UTC 时间在 dB2.table2.a_est_ts 中正确转换为 EST 时间。

SELECT dsr_ticket_number, from_utc_timestamp(acknowledgement_timestamp, 'EST') from data_prcy_pds_sanitized.dsr_sor_delete_request  
where dsr_ticket_number, from_utc_timestamp(acknowledgement_timestamp, 'EST')
in (select dsr_ticket_num,acknowledgement_est_ts from data_prcy_dsr_conformed.data_subj_rqst_delete)

给我一条错误消息:org.apache.spark.sql.catalyst.parser.ParseException: mismatched input ',' expecting <EOF>(line 2, pos 23)

标签: hadoophivehiveql

解决方案


使用 join 而不是 IN:

select a.dsr_ticket_number, from_utc_timestamp(acknowledgement_timestamp, 'EST') 
  from data_prcy_pds_sanitized.dsr_sor_delete_request a
       left join (select distinct dsr_ticket_num, acknowledgement_est_ts 
                    from data_prcy_dsr_conformed.data_subj_rqst_delete) b
       on a.dsr_ticket_number = b.dsr_ticket_num 
          and from_utc_timestamp(a.acknowledgement_timestamp, 'EST') = b.acknowledgement_est_ts 
 where b.dsr_ticket_num is not null
 --or to find records which are not in second table
 --use WHERE b.dsr_ticket_num is null 

推荐阅读