1、查看分区
Hive> show partitions table_name;
dt=20101101
dt=20101102
....
Time taken: 0.140 seconds, Fetched: 10 row(s)
2、 hive>desc tb partition(dt=20170612)
3.hive> desc extended tb partition(dt=20170612)
可以用这个命令查看有时候建立分区是在特定指定location的。
4、建立分区表
CREATE EXTERNAL TABLE seed_my (col MAP<STRING, STRING>) partitioned by (dt string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' COLLECTION ITEMS TERMINATED BY ' ' MAP KEYS TERMINATED BY '|' STORED AS INPUTFORMAT "org.apache.hadoop.mapred.TextInputFormat" OUTPUTFORMAT "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat" LOCATION 's3://up/seed/myhome';