The HCatalog command line interface (CLI) can be invoked as HIVE_HOME=
hive_home hcat_home/bin/hcat
where hive_home is the directory where Hive has been installed and hcat_home is the directory where HCatalog has been installed.
If you are using BigTop's rpms or debs you can invoke the CLI by doing /usr/bin/hcat
.
The HCatalog CLI supports these command line options:
Option | Usage | Description |
---|---|---|
-g |
| Tells HCatalog that the table which needs to be created must have group "mygroup". |
-p |
| Tells HCatalog that the table which needs to be created must have permissions "rwxr-xr-x". |
-f |
| Tells HCatalog that myscript.hcatalog is a file containing DDL commands to execute. |
-e |
| Tells HCatalog to treat the following string as a DDL command and execute it. |
-D |
| Passes the key-value pair to HCatalog as a Java System Property. |
|
| Prints a usage message. |
Note the following:
If no option is provided, then a usage message is printed:
Usage: hcat { -e "<query>" | -f <filepath> } [-g <group>] [-p <perms>] [-D<name>=<value>] |
When using the HCatalog CLI, you cannot specify a permission string without read permissions for owner, such as -wxrwxr-x
, because the string begins with "-
". If such a permission setting is desired, you can use the octal version instead, which in this case would be 375. Also, any other kind of permission string where the owner has read permissions (for example r-x-----
or r--r--r--
) will work fine.
Many hcat
commands can be issued as hive
commands, including all HCatalog DDL commands. The Hive CLI includes some commands that are not available in the HCatalog CLI. Note these differences:
hcat -g
" and "hcat -p
" for table group and permission settings are only available in the HCatalog CLI.hcat
uses the -p
flag for permissions but hive
uses it to specify a port number.hcat
uses the -D
flag without a space to define key=value pairs but hive
uses -d
or --define
with a space (also --hivevar
).hcat -DA=B
" versus "hive -d A=B
".hcat
without any flags prints a help message but hive
uses the -H
flag or --help
.The Hive CLI is documented here.
HCatalog supports all Hive Data Definition Language except those operations that require running a MapReduce job. For commands that are supported, any variances are noted below.
HCatalog does not support the following Hive DDL and other HiveQL commands:
For information about using WebHCat for DDL commands, see URL Format and WebHCat Reference: DDL Resources.
If you create a table with a CLUSTERED BY clause you will not be able to write to it with Pig or MapReduce. This is because they do not understand how to partition the table, so attempting to write to it would cause data corruption.
Not supported. Throws an exception with the message "Operation Not Supported".
Supported. Behavior the same as Hive.
Supported except for the REBUILD and CONCATENATE options. Behavior the same as Hive.
Note: Pig and MapReduce cannot read from or write to views.
Supported. Behavior same as Hive.
Supported. Behavior same as Hive.
Supported. Behavior same as Hive.
Supported. Behavior same as Hive.
Not supported. Throws an exception with message "Operation Not Supported".
Supported. Behavior same as Hive.
Supported. Behavior same as Hive.
CREATE and DROP INDEX operations are supported.
Note: Pig and MapReduce cannot write to a table that has auto rebuild on, because Pig and MapReduce do not know how to rebuild the index.
CREATE and DROP FUNCTION operations are supported, but created functions must still be registered in Pig and placed in CLASSPATH for MapReduce.
Supported. Behavior same as Hive.
Any command not listed above is NOT supported and throws an exception with the message "Operation Not Supported".
If a failure results in a message like "2010-11-03 16:17:28,225 WARN hive.metastore ... - Unable to connect metastore with URI thrift://..." in |
If other errors occur while using the HCatalog CLI, more detailed messages are written to /tmp/<username>/hive.log.
Previous: Reader and Writer Interfaces Hive command line interface: Hive CLI General: HCatalog Manual – WebHCat Manual – Hive Wiki Home – Hive Project Site |