I'm trying to do a kind of Spark "StartsWith" in Hive. I have been reading to do this and what i found is to do it with a substring
I have a string, if this string starts with UTC8 I have to add this prefix UTC8-Min8 otherwise if it starts with PMM1 I would have to add the prefix NTC2-Min8 to an existing column.
i think if you remove double quote it should work. You have few syntax error though. COuld you pls try below code?
SELECT
id, sum, address,
CASE
WHEN substring(trim(prd_ex),1,4) = 'UTC8' THEN CONCAT('UTC8-Min8',column_exe)
WHEN substring(trim(prd_ex),1,4) = 'PMM1' THEN CONCAT('NTC2-Min8',column_exe)
END
AS col_type
from Table1;