hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Hadoop Wiki] Update of "Hive/LanguageManual/LanguageManual/Cli" by suresh antony
Date Thu, 22 Jan 2009 00:44:19 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.

The following page has been changed by suresh antony:

New page:
= Hive Cli =

$HIVE_HOME/bin/hive is an interactive shell utility. Use this to run hive queries. Use ";"(semicolon)
to separate different commands in shell.

== Hive Command line Options ==

Usage: hive [-hiveconf x=y]* [<-f filename>|<-e query-string>] [-S]

  -e 'quoted query string'  Sql from command line
  -f <filename>             Sql from file
  -S                        Silent mode in interactive shell
  -hiveconf x=y             Use this to set hive/hadoop configuration variables. Hive variables
are documented [[here]]

-e and -f cannot be specified together. In the absence of these
options, interactive shell is started

 * Example of running Query from command line
   * $HIVE_HOME/bin/hive -e 'select a.col from tab1 a'
 * Example of setting hive configuration variables
   *  $HIVE_HOME/bin/hive -e 'select a.col from tab1 a' -hiveconf hive.exec.scratchdir=/home/my/hive_scratch
 -hiveconf mapred.reduce.tasks=32

== Hive interactive Shell Command  ==

When  $HIVE_HOME/bin/hive  ran without  any -e/-f option it goes into interactive shell mode.

 * hive> quit;
   * Use quit or exit to come out of interactive shell.

 * hive> set; 
   * This will print list of configuration variables that overriden by user or hive. 
 * hive> set -v;
   * This will give all possible hadoop/hive configuration variables.
 * hive> set <key>=<value>;
   * Use this set value of particular parameter. One thing to note here is that if you miss
spell the variable name, there cli will not show an error.
 * hive> set key;
   * Use this check the value of particular variable.

 * hive> add FILE <value> <value>*;
   * Adds a file to the list of resources. 
 * hive> list FILE;
   * list all the resources already added.
 * hive> list FILE <value>*;
   * Check given resources are already added or not.

 * hive> ! <cmd>;
   * execute a shell command from hive shell

 * hive> dfs <dfs command>;
   * execute dfs command command from hive shell.

 * hive> <query string> ;
   * executes hive query and prints results to stdout.

=== Hive Resources ===
You can add a file to list of resources using 'add FILE <file>'. This could be a local
file or nfs file.
Once files is added to the list of  resources, hive query could access this file from any
where in the cluster. Otherwise location of 
the file must be accessible to all machines in cluster.

  hive> add FILE /tmp/tt.py
  hive> from networks a  MAP a.networkid USING 'python tt.py' as nn where a.ds = '2009-01-04'
limit  10;



View raw message