今天遇到了个小问题:
如何在分区表之间复制部分分区数据?
-- 源分区表,分区为part CREATE TABLE IF NOT EXISTS co_v2_test( a1 string )partitioned by (part string); insert overwrite table co_v2_test partition(part='2016-06-22') select '1' from dual; select * from co_v2_test; -- 目标分区表,与源定义,分区相同 drop table if exists co_v2_test1; CREATE TABLE IF NOT EXISTS co_v2_test1( a1 string )partitioned by (part string); -- 复制方法:insert insert overwrite table co_v2_test1 partition (part) select * from co_v2_test
where part in(p1,p2,p3) ; -- 选择需要的分区