Support Questions

Find answers, ask questions, and share your expertise

Hive - Select columns using parameter

New Contributor

I am trying to select specific columns from a table in hive using a parameter.

This will allow users to choose a menu in commandline and the bash script will send the relevant predefined selections as parameters.

my hql looks like this:

SELECT ${hiveconf} FROM myTbl LIMIT 10;

and the call I am testing is:

hive -hiveconf columns='fname, lname' -f test.hql > test_output.txt

New Contributor

As is customary, I figured it out almost immediately after posting this.

Solution was:

hive -hiveconf columns="'fname', 'lname'" -f test.hql > test_output.txt