MAPREDUCE服务 MRS-SHOW TABLE/PARTITION EXTENDED:示例

时间:2024-04-10 09:06:18

示例

-- 演示数据准备
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)
support.huaweicloud.com/cmpntguide-lts-mrs/mrs_01_2499041.html