-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BugFix] Fix partition prune error after truncate list partition (bac…
- Loading branch information
1 parent
5f11b80
commit dae5d8d
Showing
3 changed files
with
110 additions
and
0 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
59 changes: 59 additions & 0 deletions
59
test/sql/test_list_partition/R/test_select_after_truncate_list_partition
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,59 @@ | ||
-- name: test_select_after_truncate_list_partition | ||
create database test_select_after_truncate_list_partition_zz1; | ||
-- result: | ||
-- !result | ||
use test_select_after_truncate_list_partition_zz1; | ||
-- result: | ||
-- !result | ||
CREATE TABLE IF NOT EXISTS t_ptr_label_ice( | ||
obj_id string not null COMMENT'客户编号', | ||
lab_numr string not null COMMENT'标签编号', | ||
busi_date string not null COMMENT'业务日期', | ||
lab_val VARCHAR(1048576) COMMENT'值' | ||
)UNIQUE KEY(obj_id, lab_numr, busi_date) | ||
PARTITION BY LIST (lab_numr, busi_date)( | ||
PARTITION p1 VALUES IN (("lab1", "2022-01-01")), | ||
PARTITION p2 VALUES IN (("lab3", "2022-01-03")), | ||
PARTITION p3 VALUES IN (("lab5", "2022-01-07")), | ||
PARTITION p4 VALUES IN (("lab9", "2022-01-09")) | ||
) | ||
DISTRIBUTED BY HASH(obj_id); | ||
-- result: | ||
-- !result | ||
INSERT INTO t_ptr_label_ice (obj_id, lab_numr, busi_date, lab_val) VALUES | ||
('obj1', 'lab1', '2022-01-01', 'val1'), | ||
('obj2', 'lab1', '2022-01-01', 'val2'), | ||
('obj3', 'lab3', '2022-01-03', 'val3'), | ||
('obj4', 'lab3', '2022-01-03', 'val4'), | ||
('obj5', 'lab3', '2022-01-03', 'val5'), | ||
('obj6', 'lab3', '2022-01-03', 'val6'), | ||
('obj7', 'lab5', '2022-01-07', 'val7'), | ||
('obj8', 'lab5', '2022-01-07', 'val8'), | ||
('obj9', 'lab9', '2022-01-09', 'val9'), | ||
('obj10', 'lab9', '2022-01-09', 'val10'); | ||
-- result: | ||
-- !result | ||
select count(*) from t_ptr_label_ice where busi_date="2022-01-01" ; | ||
-- result: | ||
2 | ||
-- !result | ||
ALTER TABLE t_ptr_label_ice truncate PARTITION p1; | ||
-- result: | ||
-- !result | ||
INSERT INTO t_ptr_label_ice (obj_id, lab_numr, busi_date, lab_val) VALUES | ||
('obj1', 'lab1', '2022-01-01', 'val1'), | ||
('obj2', 'lab1', '2022-01-01', 'val2'), | ||
('obj3', 'lab3', '2022-01-03', 'val3'), | ||
('obj4', 'lab3', '2022-01-03', 'val4'), | ||
('obj5', 'lab3', '2022-01-03', 'val5'), | ||
('obj6', 'lab3', '2022-01-03', 'val6'), | ||
('obj7', 'lab5', '2022-01-07', 'val7'), | ||
('obj8', 'lab5', '2022-01-07', 'val8'), | ||
('obj9', 'lab9', '2022-01-09', 'val9'), | ||
('obj10', 'lab9', '2022-01-09', 'val10'); | ||
-- result: | ||
-- !result | ||
select count(*) from t_ptr_label_ice where busi_date="2022-01-01" ; | ||
-- result: | ||
2 | ||
-- !result |
50 changes: 50 additions & 0 deletions
50
test/sql/test_list_partition/T/test_select_after_truncate_list_partition
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,50 @@ | ||
-- name: test_select_after_truncate_list_partition | ||
create database test_select_after_truncate_list_partition_zz1; | ||
use test_select_after_truncate_list_partition_zz1; | ||
|
||
CREATE TABLE IF NOT EXISTS t_ptr_label_ice( | ||
obj_id string not null COMMENT'客户编号', | ||
lab_numr string not null COMMENT'标签编号', | ||
busi_date string not null COMMENT'业务日期', | ||
lab_val VARCHAR(1048576) COMMENT'值' | ||
)UNIQUE KEY(obj_id, lab_numr, busi_date) | ||
PARTITION BY LIST (lab_numr, busi_date)( | ||
PARTITION p1 VALUES IN (("lab1", "2022-01-01")), | ||
PARTITION p2 VALUES IN (("lab3", "2022-01-03")), | ||
PARTITION p3 VALUES IN (("lab5", "2022-01-07")), | ||
PARTITION p4 VALUES IN (("lab9", "2022-01-09")) | ||
) | ||
DISTRIBUTED BY HASH(obj_id); | ||
|
||
|
||
INSERT INTO t_ptr_label_ice (obj_id, lab_numr, busi_date, lab_val) VALUES | ||
('obj1', 'lab1', '2022-01-01', 'val1'), | ||
('obj2', 'lab1', '2022-01-01', 'val2'), | ||
('obj3', 'lab3', '2022-01-03', 'val3'), | ||
('obj4', 'lab3', '2022-01-03', 'val4'), | ||
('obj5', 'lab3', '2022-01-03', 'val5'), | ||
('obj6', 'lab3', '2022-01-03', 'val6'), | ||
('obj7', 'lab5', '2022-01-07', 'val7'), | ||
('obj8', 'lab5', '2022-01-07', 'val8'), | ||
('obj9', 'lab9', '2022-01-09', 'val9'), | ||
('obj10', 'lab9', '2022-01-09', 'val10'); | ||
|
||
select count(*) from t_ptr_label_ice where busi_date="2022-01-01" ; | ||
|
||
ALTER TABLE t_ptr_label_ice truncate PARTITION p1; | ||
|
||
INSERT INTO t_ptr_label_ice (obj_id, lab_numr, busi_date, lab_val) VALUES | ||
('obj1', 'lab1', '2022-01-01', 'val1'), | ||
('obj2', 'lab1', '2022-01-01', 'val2'), | ||
('obj3', 'lab3', '2022-01-03', 'val3'), | ||
('obj4', 'lab3', '2022-01-03', 'val4'), | ||
('obj5', 'lab3', '2022-01-03', 'val5'), | ||
('obj6', 'lab3', '2022-01-03', 'val6'), | ||
('obj7', 'lab5', '2022-01-07', 'val7'), | ||
('obj8', 'lab5', '2022-01-07', 'val8'), | ||
('obj9', 'lab9', '2022-01-09', 'val9'), | ||
('obj10', 'lab9', '2022-01-09', 'val10'); | ||
|
||
select count(*) from t_ptr_label_ice where busi_date="2022-01-01" ; | ||
|
||
|