hive

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

hive [2015/09/23 20:27] (current)
Line 1: Line 1:
 +====== Invoke Hive CLI - PL/HQL Reference======
 +
 +//hive// allows you to invoke Hive CLI (command line tool) to execute a SQL statement or HQL script.
 +
 +**Syntax**:
 +
 +<code language="​sql">​
 +hive -e '​query'​ | -f file [-hiveconf var=expr ...]
 +</​code>​
 +
 +**Parameters:​**
 +
 +| **Parameter** | **Description** |
 +| -e '​query'​ | SQL statements to execute |
 +| -f file | Execute SQL statements from //file// | 
 +| -hiveconf var=expr | Hive variables |
 +
 +**Notes**:
 +
 +  * -e and -f cannot be specified together
 +  * Using -hiveconf you can specify a value from an expression
 +
 +**Example 1:**
 +
 +<code language="​sql">​
 +hive -f script.hql -hiveconf cr_date=NVL(var,​ '​1970-01-01'​)
 +</​code> ​
 +
 +**Example 2:**
 +
 +<code language="​sql">​
 +hive -e '​SELECT ' || cols || ' FROM ' || table || ' LIMIT 3' ​
 +</​code> ​
 +
 +**Compatibility**:​ Apache Hive.