If column types are the same, you can use CASE statements or UNION ALL in Hive:
SELECT
case when ${user_choice} = 1 the a else d end col1
case when ${user_choice} = 1 the b else e end col2
case when ${user_choice} = 1 the c else f end col3
FROM table1;
OR
SELECT a, b, c FROM table1 WHERE ${user_choice} = 1
UNION ALL
SELECT d, e, f FROM table1 WHERE ${user_choice} = 2
And if the data types of columns are different, or completely different scripts then call hive from shell
if if [[ ${user_choice} == "1" ]] ; then
hive -e "query one"
else
hive -e "query two"
fi
Column names also can be parametrized: https://stackoverflow.com/a/55805764/2700344
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…