zhangbutao commented on code in PR #4915:
URL: https://github.com/apache/hive/pull/4915#discussion_r1421289741
##########
ql/src/test/queries/clientpositive/insert_and_load_overwrite_drop_partition.q:
##########
@@ -0,0 +1,72 @@
+CREATE EXTERNAL TABLE `table1`(
+ `name` string,
+ `number` string)
+PARTITIONED BY (
+ `part_col` string);
+
+CREATE EXTERNAL TABLE `table2`(
+ `name` string,
+ `number` string)
+PARTITIONED BY (
+ `part_col` string);
+
+insert into table table1 values ('a', '10', 'part1');
+insert into table table1 values ('b', '11', 'part1');
+insert into table table1 values ('a2', '2', 'part2');
+
+insert into table table2 values ('x', '100', 'part1');
+insert into table table2 values ('y', '101', 'part1');
+insert into table table2 values ('z', '102', 'part1');
+insert into table table2 values ('x2', '200', 'part2');
+insert into table table2 values ('y2', '201', 'part2');
+
+--non empty input case
+alter table table2 drop partition(part_col='part1');
+
+select count(*) from table2 where part_col='part1';
+
+dfs -ls ${hiveconf:hive.metastore.warehouse.dir}/table2/part_col=part1;
+
+insert overwrite table table2 partition(part_col='part1') select name, number
from table1 where part_col='part1';
+
+select count(*) from table2 where part_col='part1';
+
+dfs -ls ${hiveconf:hive.metastore.warehouse.dir}/table2/part_col=part1;
+
+--empty input case
+alter table table2 drop partition(part_col='part2');
+
+select count(*) from table2 where part_col='part2';
+
+dfs -ls ${hiveconf:hive.metastore.warehouse.dir}/table2/part_col=part2;
+
+insert overwrite table table2 partition(part_col='part2') select name, number
from table1 where part_col='dummy_part';
+
+select count(*) from table2 where part_col='part2';
+
+dfs -ls ${hiveconf:hive.metastore.warehouse.dir}/table2/part_col=part2;
+
+--load overwrite partition
+CREATE EXTERNAL TABLE `table3`(
Review Comment:
Nit: No need create a new table here. We can reuse `table2` with a new
partition(part3) to keep the test clean.
Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]