-2

Passing parameter in hive is not working for me. My code:

hive> set x='test variable';
hive> ${hiveconf:x};

I get this error:

FAILED: Parse Error: line 1:0 cannot recognize input near ''test variable'' '<EOF>' '<EOF>'

Racil Hilan
  • 24,690
  • 13
  • 50
  • 55
Shetty
  • 29
  • 3

2 Answers2

1
hive> ${hiveconf:x};

Will literally substitute 'test variable'. so you're executing the command

hive> 'test variable';

which SHOULD result in an error, since that's not a command I've ever seen with SQL.

If you're trying to output the value of x, you just have to do

SET x;

If you want to use the value of x in a statement, you can do

SELECT * FROM TABLE tbl WHERE a=${hiveconf:x};

would run the command

SELECT * FROM TABLE tbl WHERE a='test variable';
JitterbugChew
  • 401
  • 3
  • 10
0

Try :

hive> set x='test variable';
hive> set;

You will see value of x variable among values of many variable.

abhiieor
  • 3,132
  • 4
  • 30
  • 47