This section guides users to use a Hive client in an O&M or service scenario.
cd /opt/hadoopclient
source bigdata_env
beeline
hcat -e "cmd"
cmd must be a Hive DDL statement, for example, hcat -e "show tables".
Setting method: If beeline has not been started, run the beeline --entireLineAsCommand=false command. If the beeline has been started, run the !set entireLineAsCommand false command.
After the setting, if a statement contains semicolons (;) that do not indicate the end of the statement, escape characters must be added, for example, select concat_ws('\;', collect_set(col1)) from tbl.
The following table lists common Hive Beeline commands.
For more commands, see https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients#HiveServer2Clients-BeelineCommands.
Command |
Description |
---|---|
set <key>=<value> |
Sets the value of a specific configuration variable (key). NOTE:
If the variable name is incorrectly spelled, the Beeline does not display an error. |
set |
Prints the list of configuration variables overwritten by users or Hive. |
set -v |
Prints all configuration variables of Hadoop and Hive. |
add FILE[S] <filepath> <filepath>*add JAR[S] <filepath> <filepath>*add ARCHIVE[S] <filepath> <filepath>* |
Adds one or more files, JAR files, or ARCHIVE files to the resource list of the distributed cache. |
add FILE[S] <ivyurl> <ivyurl>* add JAR[S] <ivyurl> <ivyurl>* add ARCHIVE[S] <ivyurl> <ivyurl>* |
Adds one or more files, JAR files, or ARCHIVE files to the resource list of the distributed cache using the lvy URL in the ivy://goup:module:version?query_string format. |
list FILE[S]list JAR[S]list ARCHIVE[S] |
Lists the resources that have been added to the distributed cache. |
list FILE[S] <filepath>*list JAR[S] <filepath>*list ARCHIVE[S] <filepath>* |
Checks whether given resources have been added to the distributed cache. |
delete FILE[S] <filepath>*delete JAR[S] <filepath>*delete ARCHIVE[S] <filepath>* |
Deletes resources from the distributed cache. |
delete FILE[S] <ivyurl> <ivyurl>* delete JAR[S] <ivyurl> <ivyurl>* delete ARCHIVE[S] <ivyurl> <ivyurl>* |
Delete the resource added using <ivyurl> from the distributed cache. |
reload |
Enable HiveServer2 to discover the change of the JAR file hive.reloadable.aux.jars.path in the specified path. (You do not need to restart HiveServer2.) Change actions include adding, deleting, or updating JAR files. |
dfs <dfs command> |
Runs the dfs command. |
<query string> |
Executes the Hive query and prints the result to the standard output. |