hive中查看表的信息


在hive中,我们可以通过命令查看表的创建语句、分区、及其他详细信息

查看表的分区情况

> show partitions new_partition;
OK
partition
daystr=201501120030
daystr=201501120100
daystr=201501120130
daystr=201501120200
daystr=201501120230
daystr=201501120300
daystr=201501120330
daystr=201501120400
daystr=201501120430
daystr=201501120530
Time taken: 0.305 seconds, Fetched: 10 row(s)

模糊查看表

> show tables like '*par*';
OK
tab_name
new_partition
old_partition
Time taken: 0.3 seconds, Fetched: 2 row(s)

查看表的创建语句

> show create table new_partition;
OK
createtab_stmt
CREATE TABLE `new_partition`(
  `shop_id` int, 
  `stat_date` string, 
  `ordamt` double)
PARTITIONED BY ( 
  `daystr` string)
ROW FORMAT SERDE 
  'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
  'hdfs://bigdata-training01.fuyun.com:8020/user/hive/warehouse-3.1.1/db_window.db/new_partition'
TBLPROPERTIES (
  'transient_lastDdlTime'='1532834516')
Time taken: 0.282 seconds, Fetched: 16 row(s)

查看表的结构信息(详细)

> desc formatted new_partition;
OK
col_name	data_type	comment
# col_name            	data_type           	comment             
shop_id             	int                 	                    
stat_date           	string              	                    
ordamt              	double              	                    
	 	 
# Partition Information	 	 
# col_name            	data_type           	comment             
daystr              	string              	                    
	 	 
# Detailed Table Information	 	 
Database:           	db_window           	 
OwnerType:          	USER                	 
Owner:              	rdedu               	 
CreateTime:         	Sun Jul 29 11:21:56 CST 2018	 
LastAccessTime:     	UNKNOWN             	 
Retention:          	0                   	 
Location:           	hdfs://bigdata-training01.fuyun.com:8020/user/hive/warehouse-3.1.1/db_window.db/new_partition	 
Table Type:         	MANAGED_TABLE       	 
Table Parameters:	 	 
	numFiles            	10                  
	numPartitions       	10                  
	numRows             	0                   
	rawDataSize         	0                   
	totalSize           	515                 
	transient_lastDdlTime	1532834516          
	 	 
# Storage Information	 	 
SerDe Library:      	org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe	 
InputFormat:        	org.apache.hadoop.mapred.TextInputFormat	 
OutputFormat:       	org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat	 
Compressed:         	No                  	 
Num Buckets:        	-1                  	 
Bucket Columns:     	[]                  	 
Sort Columns:       	[]                  	 
Storage Desc Params:	 	 
	serialization.format	1                   
Time taken: 0.255 seconds, Fetched: 36 row(s)

简单查看表的结构信息

> desc new_partition;
OK
col_name	data_type	comment
shop_id             	int                 	                    
stat_date           	string              	                    
ordamt              	double              	                    
daystr              	string              	                    
	 	 
# Partition Information	 	 
# col_name            	data_type           	comment             
daystr              	string              	                    
Time taken: 0.124 seconds, Fetched: 8 row(s)

查看表的扩展信息(信息更详细)

> desc extended new_partition;
OK
col_name	data_type	comment
shop_id             	int                 	                    
stat_date           	string              	                    
ordamt              	double              	                    
daystr              	string              	                    
	 	 
# Partition Information	 	 
# col_name            	data_type           	comment             
daystr              	string              	                    
	 	 
Detailed Table Information	Table(tableName:new_partition, dbName:db_window, owner:rdedu, createTime:1532834516, lastAccessTime:0, retention:0, sd:Storag
eDescriptor(cols:[FieldSchema(name:shop_id, type:int, comment:null), FieldSchema(name:stat_date, type:string, comment:null), FieldSchema(name:ordamt, type:double, comment:null), FieldSchema(name:daystr, type:string, comment:null)], location:hdfs://bigdata-training01.fuyun.com:8020/user/hive/warehouse-3.1.1/db_window.db/new_partition, inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), partitionKeys:[FieldSchema(name:daystr, type:string, comment:null)], parameters:{transient_lastDdlTime=1532834516, totalSize=515, numRows=0, rawDataSize=0, numFiles=10, numPartitions=10}, viewOriginalText:null, viewExpandedText:null, tableType:MANAGED_TABLE, rewriteEnabled:false, catName:hive, ownerType:USER)	
Time taken: 0.119 seconds, Fetched: 10 row(s)
  • 4
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值