Summary -

In this topic, we described about the CLI with detailed example.

CLI is abbreviated as command line interface (CLI). The HCatalog command line interface (CLI) can be invoked as HCATALOG_HOME= hcat_home/bin/hcat.

hcat_home is the directory where HCatalog has been installed. User can also invoke the CLI by doing /usr/bin/hcat. The HCatalog CLI supports the below command line options -

Option Usage / ExampleDescription
hcat Prints usage messages.
-g hcat -g group-name ... The table that needs to be created must have group "group-name".
-p hcat -p rwxr-xr-x ... The table that needs to be created must have permissions "rwxr-xr-x".
-f hcat -f userscript.hcatalog ... Specifies userscript.hcatalog is a file containing DDL commands to execute.
-e hcat -e 'create table usertable(a int);' ... Specifies HCatalog to treat the specified string as a DDL command and execute it.
-D hcat -Dkey=value ... Passes the key-value pair to HCatalog as a Java System Property.
  • The -g and -p options are optional.
  • Either -e or -f option can be provided, but not both.
  • The orders of options are not important and can specify the options in any order.

If no option is provided, then a usage message is like below

Usage:  hcat  { -e "<query>" |
 -f <filepath> }  [-g <group>] 
 [-p <perms>] [-D<name>=<value>]
 

Many of hcat commands can be used as HCatalog commands which include all HCatalog DDL commands. The HCatalog CLI includes some commands which are not available in the HCatalog CLI. "hcat -g" and "hcat -p" for table group and permission settings are only available in the HCatalog CLI.