检查一个hive表的列值是否包含其他列值

检查一个hive表的列值是否包含其他列值

问题描述:

我有表A和表B.表A列id的值就像abc-0924-0-3,表B的列id值就像abc-0924,我想要检查表A的列ID值是否包含每行的表B列ID值。检查一个hive表的列值是否包含其他列值

THX

如果格式是一致的(即,在表A中的ID的前8个字符是等于在表B中的ID),则可以加入使用前8个字符:

select 
    table_a.id as table_a_id, 
    case when table_b.id is null then 'Missing' else 'Not missing' end as status 
from table_a 
left outer join table_b 
on substr(table_a.id, 1, 8) = table_b.id