Describe
- Describe Database
- Describe Table/view/column
- Display Column Statistics
- Describe Partition
Describe Database
Version Information
Icon
As of Hive 0.7.
DESCRIBE DATABASE [EXTENDED] db_name; DESCRIBE SCHEMA [EXTENDED] db_name; -- (Note: Hive 0.15 . 0 and later) |
DESCRIBE database shows the name of the database, its comment (if one have been set), and its root location on the Filesyst Em. The uses of the SCHEMA and DATABASE are interchangeable–they mean the same thing. DESCRIBE SCHEMA is added in Hive 0.15 (HIVE-8803).
EXTENDED also shows the database properties.
Describe Table/view/column
DESCRIBE [EXTENDED|FORMATTED] [db_name.]table_name[.col_name ( [.field_name] | [. ‘$elem$‘ ] | [. ‘$key$‘ ] | [. ‘$value$‘ ] )* ]; |
DESCRIBE shows the list of columns including partition columns for the given table. If The EXTENDED keyword is specified then it'll show all the metadata for the table in Thrift serialized form. This was generally only useful for debugging If The formatted keyword is specified and then it'll show the metadata in a tabular format.
Note:describe EXTENDED shows the number of rows only if statistics were gathered when the data is loaded (see newly Crea Ted Tables), and if the Hive CLI is used instead of a Thrift client or Beeline. HIVE-6285 'll address this issue. Although ANALYZE TABLE gathers statistics after the data have been loaded (see Existing Tables), it does not currently Prov IDE information about the number of rows.
If A table has a complex column so you can examine the attributes of this column by specifying Table_name.complex_col_na Me (and ' $elem $ ' for the array element, ' $key $ ' for the map key, and ' $value $ ' for map value). You can specify this recursively to explore the complex column type.
For a view, DESCRIBE EXTENDED or formatted can is used to retrieve the view ' s definition. Relevant attributes is provided:both the original view definition as specified by the user, and an expanded Definiti On used internally by Hive.
Version Information
Icon
In Hive 0.10.0 and earlier, no distinction are made between partition columns and Non-partition columns while displaying CO Lumns for DESCRIBE TABLE. From Hive 0.12.0 onwards, they is displayed separately.
In Hive 0.13.0 and later, the configuration parameter hive.display.partition.cols.separately lets your use of the old behavior , if desired (HIVE-6689). For a example, see the "Test case" in the "Patch for HIVE-6689".
Bug Fixed in Hive 0.10.0
Icon
Database Qualifiers for table names were introduced in Hive 0.7.0, but they were broken for DESCRIBE until a bug fix in Hi ve 0.10.0 (HIVE-1977).
Display Column Statistics
Version Information
Icon
As of Hive 0.14.0; See HIVE-7050 and HIVE-7051. (The For COLUMNS option, ANALYZE TABLE is available as of Hive 0.10.0.)
ANALYZE table table_name compute STATISTICS for COLUMNS would COMPUTE column STATISTICS for all Colu MNS in the specified table (and for all partitions if the table is partitioned). To view the gathered column statistics, the following statements can be used:
DESCRIBE FORMATTED [db_name.]table_name.column_name; -- (Note: Hive 0.14 . 0 and later) DESCRIBE FORMATTED [db_name.]table_name.column_name PARTITION (partition_spec); -- (Note: Hive 0.14 . 0 and later) |
See Statistics in hive:existing Tables For more information about the ANALYZE TABLE command.
Describe Partition
DESCRIBE [EXTENDED|FORMATTED] [db_name.]table_name PARTITION partition_spec; |
This statement lists metadata for a given partition. The output is similar to that of DESCRIBE table_name. Presently, the column information associated with a particular partition are not used while preparing plans.
Example:
DESCRIBE page_view PARTITION (ds= ‘2008-08-08‘ ); |
[Hive-languagemanual] Describe