-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HIVE-28166: Iceberg: Truncate on branch operates on the main table. (#…
…5173). (Ayush Saxena, reviewed by Denys Kuzmenko)
- Loading branch information
Showing
11 changed files
with
290 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
iceberg/iceberg-handler/src/test/queries/positive/truncate_iceberg_branch.q
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
-- SORT_QUERY_RESULTS | ||
set hive.explain.user=false; | ||
set hive.fetch.task.conversion=more; | ||
|
||
create external table ice01(id int) stored by iceberg stored as orc tblproperties ('format-version'='2'); | ||
|
||
insert into ice01 values (1), (2), (3), (4); | ||
|
||
select * from ice01; | ||
|
||
-- create a branch named branch1 | ||
alter table ice01 create branch branch1; | ||
select * from default.ice01.branch_branch1; | ||
|
||
-- insert some data to branch | ||
insert into ice01 values (5), (6); | ||
select * from default.ice01.branch_branch1; | ||
|
||
-- truncate the branch | ||
truncate table default.ice01.branch_branch1; | ||
select * from default.ice01.branch_branch1; | ||
|
||
-- create a partioned iceberg table | ||
create external table ice02(id int) partitioned by (name string) stored by iceberg stored as orc tblproperties ('format-version'='2'); | ||
insert into ice02 values (1, 'A'), (2, 'B'), (3, 'A'), (4, 'B'); | ||
|
||
select * from ice02; | ||
|
||
-- create a branch named branch1 | ||
alter table ice02 create branch branch1; | ||
|
||
-- insert some data to branch | ||
insert into default.ice02.branch_branch1 values (5, 'A'), (6, 'C'); | ||
select * from default.ice02.branch_branch1; | ||
|
||
-- truncate partition A | ||
truncate table default.ice02.branch_branch1 partition (name='A'); | ||
|
||
select * from default.ice02.branch_branch1; | ||
|
||
-- check original table is intact. | ||
select * from ice02; | ||
|
||
-- partition evolution | ||
alter table ice02 set partition spec (id); | ||
|
||
truncate table default.ice02.branch_branch1 partition (name='C'); | ||
select * from default.ice02.branch_branch1; |
188 changes: 188 additions & 0 deletions
188
iceberg/iceberg-handler/src/test/results/positive/truncate_iceberg_branch.q.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
PREHOOK: query: create external table ice01(id int) stored by iceberg stored as orc tblproperties ('format-version'='2') | ||
PREHOOK: type: CREATETABLE | ||
PREHOOK: Output: database:default | ||
PREHOOK: Output: default@ice01 | ||
POSTHOOK: query: create external table ice01(id int) stored by iceberg stored as orc tblproperties ('format-version'='2') | ||
POSTHOOK: type: CREATETABLE | ||
POSTHOOK: Output: database:default | ||
POSTHOOK: Output: default@ice01 | ||
PREHOOK: query: insert into ice01 values (1), (2), (3), (4) | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: _dummy_database@_dummy_table | ||
PREHOOK: Output: default@ice01 | ||
POSTHOOK: query: insert into ice01 values (1), (2), (3), (4) | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: _dummy_database@_dummy_table | ||
POSTHOOK: Output: default@ice01 | ||
PREHOOK: query: select * from ice01 | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@ice01 | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: select * from ice01 | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@ice01 | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
1 | ||
2 | ||
3 | ||
4 | ||
PREHOOK: query: alter table ice01 create branch branch1 | ||
PREHOOK: type: ALTERTABLE_CREATEBRANCH | ||
PREHOOK: Input: default@ice01 | ||
POSTHOOK: query: alter table ice01 create branch branch1 | ||
POSTHOOK: type: ALTERTABLE_CREATEBRANCH | ||
POSTHOOK: Input: default@ice01 | ||
PREHOOK: query: select * from default.ice01.branch_branch1 | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@ice01 | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: select * from default.ice01.branch_branch1 | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@ice01 | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
1 | ||
2 | ||
3 | ||
4 | ||
PREHOOK: query: insert into ice01 values (5), (6) | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: _dummy_database@_dummy_table | ||
PREHOOK: Output: default@ice01 | ||
POSTHOOK: query: insert into ice01 values (5), (6) | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: _dummy_database@_dummy_table | ||
POSTHOOK: Output: default@ice01 | ||
PREHOOK: query: select * from default.ice01.branch_branch1 | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@ice01 | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: select * from default.ice01.branch_branch1 | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@ice01 | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
1 | ||
2 | ||
3 | ||
4 | ||
PREHOOK: query: truncate table default.ice01.branch_branch1 | ||
PREHOOK: type: TRUNCATETABLE | ||
PREHOOK: Output: default@ice01 | ||
POSTHOOK: query: truncate table default.ice01.branch_branch1 | ||
POSTHOOK: type: TRUNCATETABLE | ||
POSTHOOK: Output: default@ice01 | ||
PREHOOK: query: select * from default.ice01.branch_branch1 | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@ice01 | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: select * from default.ice01.branch_branch1 | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@ice01 | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
PREHOOK: query: create external table ice02(id int) partitioned by (name string) stored by iceberg stored as orc tblproperties ('format-version'='2') | ||
PREHOOK: type: CREATETABLE | ||
PREHOOK: Output: database:default | ||
PREHOOK: Output: default@ice02 | ||
POSTHOOK: query: create external table ice02(id int) partitioned by (name string) stored by iceberg stored as orc tblproperties ('format-version'='2') | ||
POSTHOOK: type: CREATETABLE | ||
POSTHOOK: Output: database:default | ||
POSTHOOK: Output: default@ice02 | ||
PREHOOK: query: insert into ice02 values (1, 'A'), (2, 'B'), (3, 'A'), (4, 'B') | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: _dummy_database@_dummy_table | ||
PREHOOK: Output: default@ice02 | ||
POSTHOOK: query: insert into ice02 values (1, 'A'), (2, 'B'), (3, 'A'), (4, 'B') | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: _dummy_database@_dummy_table | ||
POSTHOOK: Output: default@ice02 | ||
PREHOOK: query: select * from ice02 | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@ice02 | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: select * from ice02 | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@ice02 | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
1 A | ||
2 B | ||
3 A | ||
4 B | ||
PREHOOK: query: alter table ice02 create branch branch1 | ||
PREHOOK: type: ALTERTABLE_CREATEBRANCH | ||
PREHOOK: Input: default@ice02 | ||
POSTHOOK: query: alter table ice02 create branch branch1 | ||
POSTHOOK: type: ALTERTABLE_CREATEBRANCH | ||
POSTHOOK: Input: default@ice02 | ||
PREHOOK: query: insert into default.ice02.branch_branch1 values (5, 'A'), (6, 'C') | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: _dummy_database@_dummy_table | ||
PREHOOK: Output: default@ice02 | ||
POSTHOOK: query: insert into default.ice02.branch_branch1 values (5, 'A'), (6, 'C') | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: _dummy_database@_dummy_table | ||
POSTHOOK: Output: default@ice02 | ||
PREHOOK: query: select * from default.ice02.branch_branch1 | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@ice02 | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: select * from default.ice02.branch_branch1 | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@ice02 | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
1 A | ||
2 B | ||
3 A | ||
4 B | ||
5 A | ||
6 C | ||
PREHOOK: query: truncate table default.ice02.branch_branch1 partition (name='A') | ||
PREHOOK: type: TRUNCATETABLE | ||
PREHOOK: Output: default@ice02@name=A | ||
POSTHOOK: query: truncate table default.ice02.branch_branch1 partition (name='A') | ||
POSTHOOK: type: TRUNCATETABLE | ||
POSTHOOK: Output: default@ice02@name=A | ||
PREHOOK: query: select * from default.ice02.branch_branch1 | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@ice02 | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: select * from default.ice02.branch_branch1 | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@ice02 | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
2 B | ||
4 B | ||
6 C | ||
PREHOOK: query: select * from ice02 | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@ice02 | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: select * from ice02 | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@ice02 | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
1 A | ||
2 B | ||
3 A | ||
4 B | ||
PREHOOK: query: alter table ice02 set partition spec (id) | ||
PREHOOK: type: ALTERTABLE_SETPARTSPEC | ||
PREHOOK: Input: default@ice02 | ||
POSTHOOK: query: alter table ice02 set partition spec (id) | ||
POSTHOOK: type: ALTERTABLE_SETPARTSPEC | ||
POSTHOOK: Input: default@ice02 | ||
POSTHOOK: Output: default@ice02 | ||
PREHOOK: query: truncate table default.ice02.branch_branch1 partition (name='C') | ||
PREHOOK: type: QUERY | ||
PREHOOK: Output: default@ice02@name=C | ||
POSTHOOK: query: truncate table default.ice02.branch_branch1 partition (name='C') | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Output: default@ice02@name=C | ||
PREHOOK: query: select * from default.ice02.branch_branch1 | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@ice02 | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: select * from default.ice02.branch_branch1 | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@ice02 | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
2 B | ||
4 B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.