-
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] add limit operator before union gather (#53102)
Signed-off-by: stdpain <[email protected]>
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
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,28 @@ | ||
-- name: test_union_all_with_limit | ||
CREATE TABLE `t0` ( | ||
`c0` int(11) NULL COMMENT "", | ||
`c1` varchar(20) NULL COMMENT "", | ||
`c2` varchar(200) NULL COMMENT "", | ||
`c3` int(11) NULL COMMENT "" | ||
) ENGINE=OLAP | ||
DUPLICATE KEY(`c0`, `c1`) | ||
COMMENT "OLAP" | ||
DISTRIBUTED BY HASH(`c0`, `c1`) BUCKETS 48 | ||
PROPERTIES ( | ||
"colocate_with" = "${uuid0}", | ||
"replication_num" = "1", | ||
"in_memory" = "false", | ||
"storage_format" = "DEFAULT", | ||
"enable_persistent_index" = "false", | ||
"replicated_storage" = "true", | ||
"compression" = "LZ4" | ||
); | ||
-- result: | ||
-- !result | ||
insert into t0 SELECT generate_series, generate_series, generate_series, generate_series FROM TABLE(generate_series(1, 40960)); | ||
-- result: | ||
-- !result | ||
select count(*) from (select c0 from t0 union all select distinct c0 from t0 limit 1)t; | ||
-- result: | ||
1 | ||
-- !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,24 @@ | ||
-- name: test_union_all_with_limit | ||
|
||
CREATE TABLE `t0` ( | ||
`c0` int(11) NULL COMMENT "", | ||
`c1` varchar(20) NULL COMMENT "", | ||
`c2` varchar(200) NULL COMMENT "", | ||
`c3` int(11) NULL COMMENT "" | ||
) ENGINE=OLAP | ||
DUPLICATE KEY(`c0`, `c1`) | ||
COMMENT "OLAP" | ||
DISTRIBUTED BY HASH(`c0`, `c1`) BUCKETS 48 | ||
PROPERTIES ( | ||
"colocate_with" = "${uuid0}", | ||
"replication_num" = "1", | ||
"in_memory" = "false", | ||
"storage_format" = "DEFAULT", | ||
"enable_persistent_index" = "false", | ||
"replicated_storage" = "true", | ||
"compression" = "LZ4" | ||
); | ||
|
||
insert into t0 SELECT generate_series, generate_series, generate_series, generate_series FROM TABLE(generate_series(1, 40960)); | ||
|
||
select count(*) from (select c0 from t0 union all select distinct c0 from t0 limit 1)t; |