I was wondering is it possible to do transposition corresponding few columns in pig/hive.
as dealing with data i got below requirement
id jan
Yes this is definitely possible in Hive using the built-in "stack" UDF and a case statement. Something like this should work:
select id, value, CASE
WHEN value like 'j%'
THEN 'jan'
WHEN value like 'f%'
THEN 'feb'
WHEN value like 'm%'
THEN 'march'
ELSE ''
END as month
from table
lateral view stack(3, jan, feb, march) tb as value
;
Let me know if this works.