更新时间:2024-12-31 GMT+08:00
SHOW TABLE/PARTITION EXTENDED
语法
SHOW TABLE EXTENDED [IN | FROM schema_name] LIKE 'identifier_with_wildcards' [PARTITION (partition_spec)]
描述
用于展示表或分区的详细信息。
可以使用规则运算表达式来同时匹配多个表,但不可用于匹配分区。
展示的信息将包括表的基本信息和相关的文件系统信息,其中文件系统信息包括总文件数、总文件大小、最大文件长度、最小文件长度、最后访问时间以及最后更新时间。如果指定了分区,将给出指定分区的文件系统信息,而不是分区所在表的文件系统信息。
参数说明
示例
-- 演示数据准备
create schema 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:obs://bucket/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:obs://bucket/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 obs://bucket/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 obs://bucket/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 obs://bucket/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:obs://bucket/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)
父主题: DDL 语法