HCatalog Describe

The "DESCRIBE" statement can be used on the following three items to get or display information for the specified type:

  • Describe Database
  • Describe Table/View/Column
  • Describe Partition

Describe Database (Version: Hive 0.7)

DESCRIBE DATABASE displays the database name, its comment, and the root location in the file system. The uses of SCHEMA and DATABASE are interchangeable. DESCRIBE SCHEMA was added in Hive 0.15. The EXTENDED option also displays the database properties.

Syntax -

DESCRIBE DATABASE [EXTENDED] db_name;

DESCRIBE SCHEMA [EXTENDED] db_name;

Describe Table | View | Column

DESCRIBE shows/displays the list of columns (including partition columns) for the given table.

EXTENDED, FORMATTED keyword is optional. If the EXTENDED is specified, it will show/displays all the metadata for the specified table. If the FORMATTED is specified, it will show or displays the metadata in a tabular format.

For a view, you can use DESCRIBE EXTENDED or FORMATTED to retrieve its definition.

Syntax -

DESCRIBE [EXTENDED|FORMATTED]  
  [db_name.]table_name[.col_name ( [.field_name] |
   [.'$elem$'] | [.'$key$'] | [.'$value$'] )* ];
   

Syntax – Column names:

DESCRIBE FORMATTED [db_name.]table_name column_name;
DESCRIBE FORMATTED [db_name.]table_name
 column_name PARTITION (partition_spec); 

Describe Partition

DESCRIBE statement describes the partition lists and metadata for a given partition. The output closely resembles that of the "DESCRIBE table_name" command. Currently, the column information linked to a specific partition is not utilized when preparing plans.

Syntax –

DESCRIBE [EXTENDED|FORMATTED] [db_name.]table_name
 [.column_name] PARTITION partition_spec;