Hive namespaces (Variables and Properties)

By | April 17, 2017

Hive namespaces (Variables and Properties)

There are total four namespaces available in Hive, we will go through each one.


This is useful in defining our own custom variables for example

Hive> set hivevar:toodey=hello;

Hive> set toodey;

Now we can use this in any Hive query statement as we have seen in my previous tutorial about create table.

CREATE TABLE toodey(t STRING, $(toodey) STRING);


This is useful when we need to set hive specific configuration parameters.

Example –

Let’s say we want to set our current working db to console or hive CLI, by default its set to FALSE.

Hive> set hiveconf:hive.cli.print.current.db=true;

Hive (default)>


This namespace provides read and write access to java system properties for example.

Hive> set


It is useful in setting environment variable define by the shell (Bash)


Hive> set env:YEAR=2017

Hive> SELECT * FROM toodey WHERE year = $ {env:YEAR};