-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enhancement] Support alter table add roll up in shared data (#53153)
Signed-off-by: smartlxh <[email protected]>
- Loading branch information
Showing
5 changed files
with
85 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-- name: test_lake_rollup @cloud | ||
CREATE TABLE tbl1 ( | ||
k1 date, | ||
k2 int, | ||
v1 int sum | ||
) PARTITION BY RANGE(k1) ( | ||
PARTITION p1 values [('2020-01-01'),('2020-02-01')), | ||
PARTITION p2 values [('2020-02-01'),('2020-03-01'))) | ||
DISTRIBUTED BY HASH(k2) BUCKETS 3 | ||
PROPERTIES('replication_num' = '1'); | ||
-- result: | ||
-- !result | ||
|
||
INSERT INTO tbl1 | ||
VALUES | ||
("2020-01-12",4,100), | ||
("2020-01-11",5,100), | ||
("2020-01-11",4,100); | ||
-- result: | ||
-- !result | ||
|
||
ALTER TABLE tbl1 ADD ROLLUP rollup1 (k1, v1) FROM tbl1; | ||
-- result: | ||
-- !result | ||
function: wait_alter_table_finish("ROLLUP") | ||
-- result: | ||
None | ||
-- !result | ||
|
||
INSERT INTO tbl1 VALUES("2020-01-11",6,100); | ||
-- result: | ||
-- !result | ||
|
||
SELECT v1 FROM rollup1 [_SYNC_MV_] ORDER BY v1; | ||
-- result: | ||
100 | ||
300 | ||
-- !result |
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,23 @@ | ||
-- name: test_lake_rollup @cloud | ||
CREATE TABLE tbl1 ( | ||
k1 date, | ||
k2 int, | ||
v1 int sum | ||
) PARTITION BY RANGE(k1) ( | ||
PARTITION p1 values [('2020-01-01'),('2020-02-01')), | ||
PARTITION p2 values [('2020-02-01'),('2020-03-01'))) | ||
DISTRIBUTED BY HASH(k2) BUCKETS 3 | ||
PROPERTIES('replication_num' = '1'); | ||
|
||
INSERT INTO tbl1 | ||
VALUES | ||
("2020-01-12",4,100), | ||
("2020-01-11",5,100), | ||
("2020-01-11",4,100); | ||
|
||
ALTER TABLE tbl1 ADD ROLLUP rollup1 (k1, v1) FROM tbl1; | ||
function: wait_alter_table_finish("ROLLUP") | ||
|
||
INSERT INTO tbl1 VALUES("2020-01-11",6,100); | ||
|
||
SELECT v1 FROM rollup1 [_SYNC_MV_] ORDER BY v1; |
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