hadoop—验证db2.table2中的db1.table1数据元素是否正确地从utc转换为est

xwbd5t1u  于 2021-05-27  发布在  Hadoop
关注(0)|答案(1)|浏览(312)

必须验证db1.table.a\u timestamp中的utc时间是否在db2.table2.a\u est\u 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)

dtcbnfnu

dtcbnfnu1#

使用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

相关问题