sqlhivehue

HiveQL HUE Argument mismatch (Query worked before)


I got a problem with my query:

SELECT
(case when duns_nbr in ('', ' ', '    ') then null else duns_nbr end) as duns_nbr
FROM dl_edge_base_atdsttdp_iidr_data_in. ra9custm

I know this query worked like a year ago, but now for some reason it's giving me issues. I get the next error: enter image description here

Any ideas on how this could be fixed?


Solution

  • Use cast to convert duns number to char.

    SELECT
    (case when cast(duns_nbr as string) in ('', ' ', '    ') then null else  cast(duns_nbr as string) end) as duns_nbr
    FROM dl_edge_base_atdsttdp_iidr_data_in.ra9custm
    

    i think if data type of duns_nbr is BIGINT, then this case when is useless and can be removed.