Search code examples
hadoophivehiveql

Is there any Hive SQL function to assess whether the field contain alphabets?


Here is my program, it is not working as Hive has limited regular expressions support, is there a similar function for Hive SQL to assess whether the column contains alphabet?

CREATE TABLE NEW_TABLE AS
SELECT *, 
case
        when **REGEXP_LIKE**(TRANSACTION_ID, '%[A-Z]%') then "PRODUCT A"
        else "PRODUCT B"
end as PRODUCT
FROM OLD_TABLE;

Solution

  •  when TRANSACTION_ID rlike '[A-Z]' then "PRODUCT A"
    

    Or additionally the same characters in lowercase:

     when TRANSACTION_ID rlike '[a-zA-Z]' then "PRODUCT A"