Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view the value of a hive variable?

Tags:

sql

apache

hql

hive

How do you view the value of a hive variable you have set with the command "SET a = 'B,C,D'"? I don't want to use the variable- just see the value I have set it to. Also is there a good resource for Hive documentation like this? The Apache website is not very helpful.

like image 790
abu Avatar asked Jun 18 '13 20:06

abu


People also ask

How do I display a variable value in hive?

You may have to write additional lines in your hive script to view the values/redirect them to a separate file. As far as I know there is no such config property. You may have to write additional lines in your hive script to view the values/redirect them to a separate file.

How do you store hive query results in a variable?

Bookmark this question. Show activity on this post. ./hive -e "use telecom;insert overwrite local directory '/tmp/result' select avg(a) from abc;" ./hive --hiveconf MY_VAR =`cat /tmp/result/000000_0`;

How do I use variables in hive?

You need to use the special hiveconf for variable substitution. e.g. Note that there are env and system variables as well, so you can reference ${env:USER} for example.

What is a hive variable What for we use it?

Hive variables are key-value pairs that can be set using the set command and they can be used in scripts and Hive SQL. The values of the variables in Hive scripts are substituted during the query construct.


1 Answers

Found my answer. The answer is simply: "Set a;" Stupid syntax IMO, but thats the way it is.

like image 126
abu Avatar answered Sep 21 '22 21:09

abu