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 JoydeepSensarma:
http://wiki.apache.org/hadoop/Hive/LanguageManual/Cli

------------------------------------------------------------------------------
  
    -e 'quoted query string'  Sql from command line
    -f <filename>             Sql from file
-   -S                        Silent mode in interactive shell
+   -S                        Silent mode in interactive shell where only data 
is emitted
    -hiveconf x=y             Use this to set hive/hadoop configuration 
variables. 
    
     -e and -f cannot be specified together. In the absence of these options, 
interactive shell is started
@@ -28, +28 @@

   * 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
+    }}}
+  * Example of dumping data out from a query into a file using silent mode
+    {{{
+    HIVE_HOME/bin/hive -S -e 'select a.col from tab1 a' > a.txt
     }}}
  
  
@@ -56, +60 @@

    hive> !ls;
    hive> dfs -ls;
  }}}
+ 
+ === Logging ===
+ Hive uses log4j for logging. These logs are not emitted to the standard 
output by default but are instead captured to a log file specified by the 
Hive's log4j properties file. By default Hive will use `hive-log4j.default` in 
the `conf/` directory of the hive installation which writes out logs to 
`/tmp/<userid>/hive.log` and uses the `WARN` level.
+ 
+ It is often desirable to emit the logs to the standard output and/or change 
the logging level for debugging purposes. These can be done from the command 
line as follows:
+ {{{ $HIVE_HOME/bin/hive -hiveconf hive.root.logger=INFO,console }}}
+ `hive.root.logger` specifies the logging level as well as the log 
destination. Specifying `console` as the target sends the logs to the standard 
error (instead of the log file).
+ 
  === Hive Resources ===
  
  Hive can manage the addition of resources to a session where those resources 
are available at query execution time. Currently the only supported resource is 
the FILE type. Any locally accessible file can be added to the session. Once a 
file is added to a session, hive query can refer to this file by it's name (in 
map/reduce/transform clauses) and this file is available locally at execution 
time on the entire hadoop cluster. Hive uses Hadoop's Distributed Cache to 
distribute the added files to all the machines in the cluster at query 
execution time. 
@@ -74, +86 @@

    hive> list FILES;
    /tmp/tt.py
    hive> from networks a  MAP a.networkid USING 'python tt.py' as nn where 
a.ds = '2009-01-04' limit  10;
- 
- }}}
+  }}}
  
  It is not neccessary to add files to the session if the files used in a 
transform script are available on all machines in the hadoop cluster using the 
same path name. For example:
   * ... MAP a.networkid USING 'wc -l' ...: here wc is an executable available 
on all machines

Reply via email to