Member since
12-29-2021
1
Post
0
Kudos Received
0
Solutions
12-29-2021
04:21 PM
Hello,
I did enough google before coming to this forum. I have table Employee with following column Names (there are 40 columns)
Employee_ID, Employee_Type, Employee_Tenure
I want to use these column names in CASE Statement as part of HIVE Query to assign value.
E.g.
Case when Column Name = 'Employee_Type' then 1 else 0
when Column Name = 'Employee_Tenure' then 2 else 0
end as Rank
I know I can "show columns in Employee" to get all column names. But I don't know how to refer output of this query in CASE statement
I also try to save results of Query into variable ( I could be wrong doing this )
set hivevar:col_names=(show columns in employee)
select '${hivevar:col_names}'
but I get below error : Error while processing statement: Variable substitution depth is deeper than 40 for expression
Any help appreciated. If my question is too naive or stupid - I apologize.
... View more
Labels: