更新时间:2024-04-09 GMT+08:00
分享

SHOW TABLE/PARTITION EXTENDED

语法

SHOW TABLE EXTENDED [IN | FROM schema_name] LIKE 'identifier_with_wildcards' [PARTITION (partition_spec)]

描述

用于展示表或分区的详细信息。

可以使用规则运算表达式来同时匹配多个表,但不可用于匹配分区。

展示的信息将包括表的基本信息和相关的文件系统信息,其中文件系统信息包括总文件数、总文件大小、最大文件长度、最小文件长度、最后访问时间以及最后更新时间。如果指定了分区,将给出指定分区的文件系统信息,而不是分区所在表的文件系统信息。

参数说明

  • IN | FROM schema_name

    指定schema名称,未指定时默认使用当前的schema。

  • LIKE 'identifier_with_wildcards'

    identifier_with_wildcards只支持包含“*”和“|”的规则匹配表达式。

    其中“*”可以匹配单个或多个字符,“|”适用于匹配多种规则匹配表达式中的任意一种的情况,它用于分隔这些规则匹配表达式。

    规则匹配表达式首尾的空格,不会参与匹配计算。

  • partition_spec

    一个可选参数,使用键值对来指定分区列表,键值对之间通过逗号分隔。需要注意,指定分区时,表名不支持模糊匹配。

示例

-- 演示数据准备
create schema show_schema;

use show_schema;

create table show_table1(a int,b string);
create table show_table2(a int,b string);
create table from_table1(a int,b string);
create table in_table1(a int,b string);

--查询表名以"show"开始的表的详细信息
show table extended  like 'show*';
                                 tab_name                                 
--------------------------------------------------------------------------
 tableName:show_table1                                                    
 owner:admintest                                                          
 location:hdfs://hacluster/user/hive/warehouse/show_schema.db/show_table1 
 InputFormat:org.apache.hadoop.hive.ql.io.orc.OrcInputFormat              
 OutputFormat:org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat            
 columns:struct columns {int a,string b}                                  
 partitioned:false                                                        
 partitionColumns:                                                        
 totalNumberFiles:0                                                       
 totalFileSize:0  
                                                        
 tableName:show_table2                                                    
 owner:admintest                                                          
 location:hdfs://hacluster/user/hive/warehouse/show_schema.db/show_table2 
 InputFormat:org.apache.hadoop.hive.ql.io.orc.OrcInputFormat              
 OutputFormat:org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat            
 columns:struct columns {int a,string b}                                  
 partitioned:false                                                        
 partitionColumns:                                                        
 totalNumberFiles:0                                                       
 totalFileSize:0                                                          

(1 row)

-- 查询表名以"from"或者"show"开头的表的详细信息
 show table extended  like 'from*|show*';
                               tab_name                               
----------------------------------------------------------------------
 tableName           show_table1                                      
 owner               admintest                                        
 location            hdfs://hacluster/user/hive/warehouse/show_table1 
 InputFormat         org.apache.hadoop.hive.ql.io.orc.OrcInputFormat  
 OutputFormat        org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat 
 columns             struct columns {int a,string b}                  
 partitioned         false                                            
 partitionColumns                                                     
 totalNumberFiles    0                                                
 totalFileSize       null                                             

 tableName           from_table1                                      
 owner               admintest                                        
 location            hdfs://hacluster/user/hive/warehouse/from_table1 
 InputFormat         org.apache.hadoop.hive.ql.io.orc.OrcInputFormat  
 OutputFormat        org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat 
 columns             struct columns {int a,string b}                  
 partitioned         false                                            
 partitionColumns                                                     
 totalNumberFiles    0                                                
 totalFileSize       null                                             

 tableName           show_table2                                      
 owner               admintest                                        
 location            hdfs://hacluster/user/hive/warehouse/show_table2 
 InputFormat         org.apache.hadoop.hive.ql.io.orc.OrcInputFormat  
 OutputFormat        org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat 
 columns             struct columns {int a,string b}                  
 partitioned         false                                            
 partitionColumns                                                     
 totalNumberFiles    0                                                
 totalFileSize       null                                             

(1 row)
-- 查询web schema下的page_views表扩展信息
 show table extended from web like 'page*';
                                  tab_name                                   
-----------------------------------------------------------------------------
 tableName:page_views                                                        
 owner:admintest                                                             
 location:hdfs://hacluster/user/web.db/page_views                            
 InputFormat:org.apache.hadoop.hive.ql.io.orc.OrcInputFormat                 
 OutputFormat:org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat               
 columns:struct columns {timestamp view_time,bigint user_id,string page_url} 
 partitioned:true                                                            
 partitionColumns: struct partition_columns {date ds,string country}         
 totalNumberFiles:0                                                          
 totalFileSize:0                                                             

(1 row)
分享:

    相关文档

    相关产品