how to pass variables in hive using hue how to pass variables in hive using hue hadoop hadoop

how to pass variables in hive using hue


I think this is the proper notation for what you are trying to achieve:

SELECT * FROM foo WHERE user = ${hiveconf:x};

Note that there is no need to surround ${hiveconf:x} with quotes, and also that the comparison operator is =, not ==. From the Hive documentation on relational operators, we have these two excerpts:

A = B TRUE if expression A is equal to expression B otherwise FALSE.

A == B Fails because of invalid syntax. SQL uses =, not ==.

So, given the following silly test table:

hive> SELECT user, fullname FROM foo;OKother_user  Bar Bazfoouser        Foo BarbazTime taken: 0.228 seconds, Fetched: 2 row(s)

Your query may look something like the following:

hive> SET x='user';hive> SELECT * FROM foo WHERE user = ${hiveconf:x};OKuser        Foo BarbazTime taken: 0.229 seconds, Fetched: 1 row(s)