Updated on 2022-11-18 GMT+08:00

DESCRIBE

Syntax

DESCRIBE [EXTENDED| FORMATTED] table_name

DESCRIBE [EXTENDED| FORMATTED] table_name PARTITION (partition_spec)

Description

This statement is used to view the metadata information of a specified table. Currently, this syntax can display only the metadata of columns, which is equivalent to the SHOW COLUMNS syntax.

After the EXTENDED keyword is added, all metadata of the table is displayed in the Thrift serialization format.

If the FORMATTED keyword is added, the metadata of the table is displayed in a table.

Example

Display the column information of the fruit data table:

DESCRIBE fruit;

Display the Fruit metadata:

DESCRIBE FORMATTED fruit;
                           Describe Formatted Table                           
------------------------------------------------------------------------------
 # col_name      data_type      comment                                       
 name      varchar                                                            
 price      integer                                                           
                                                                              
 # Detailed Table Information                                                 
 Database:                   default                                          
 Owner:                      admintest                                        
 LastAccessTime:             0                                                
 Location:                   hdfs://hacluster/user/hive/warehouse/fruit       
 Table Type:                 MANAGED_TABLE                                    
                                                                              
 # Table Parameters:                                                          
        Owner                   ggg                                                      
        STATS_GENERATED_VIA_STATS_TASK  workaround for potential lack of HIVE-12730    
        numFiles                0                                                        
        numRows                 0                                                        
        orc.compress.size       262144                                                   
        orc.compression.codec   GZIP                                                    
        orc.row.index.stride    10000                                                    
        orc.stripe.size         67108864                                                 
        presto_query_id         20210308_072339_00075_5ck2k@default@HetuEngine           
        presto_version                                                                   
        rawDataSize             0                                                        
        totalSize               0                                                        
        transient_lastDdlTime   1615188219                                              
                                                                                                                                               
 # Storage Information                                                        
 SerDe Library:              org.apache.hadoop.hive.ql.io.orc.OrcSerde        
 InputFormat:                org.apache.hadoop.hive.ql.io.orc.OrcInputFormat  
 OutputFormat:               org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat 
 Compressed:                 No                                               
 Num Buckets:                -1                                               
 Bucket Columns:             []                                               
 Sort Columns:               []                                               
 serialization.format:       1                                                
(1 row)
 
Query 20210309_022835_00007_2i9yy@default@HetuEngine, FINISHED, 1 node
Splits: 1 total, 1 done (100.00%)
0:01 [0 rows, 0B] [0 rows/s, 0B/s];