hive 中 formatted 的用法:
- select * from 表名: 查询该表名的所有字段记录
- desc formatted 表名: 查看该表的结构化数据,但并不列出表中的数据
示例:
创建一个表
create table if not exists student(
id int, name string
)
row format delimited fields terminated by '\t'
stored as textfile
location '/user/hive/warehouse/student';
使用formatted查看输出
hive (default)> desc formatted student;
Table Type: MANAGED_TABLE
结构化数据并不只包含 Table Type
表中有分区的情况
hive> desc formatted dept_partition;
# Partition Information
# col_name data_type comment
month string
表中有分桶的情况
hive (default)> desc formatted stu_buck;
Num Buckets: 4