更新时间:2024-07-24 GMT+08:00

DESCRIBE

语法

DESCRIBE [EXTENDED| FORMATTED] table_name

DESCRIBE [EXTENDED| FORMATTED] table_name PARTITION (partition_spec)

描述

查看指定表的元数据信息。该语法目前只能显示列的元数据信息,等效于语法SHOW COLUMNS。

添加EXTENDED关键字会将表的所有元数据信息以“Thrift”序列化的格式显示出来。

添加FORMATTED关键字会将表的元数据信息以表格的形式展示。

示例

显示fruit数据表的列信息:

DESCRIBE fruit;

显示fruit 元数据信息:

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];