对于创建分区表,有两种方式:
1.先建表,然后添加分区表,然后将数据直接导入进去。
2.先建表,然后导入数据,然后再添加分区表,再将数据移动进去。
这里建议选择第一种方式。避免省去数据移动的消耗。
Step 1:
create table if not exists tableName (fieldName fieldvalue)
partitioned by (dt string) row format delimited fields terminated by "`\t`" STORED AS ORC"