-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](nereids) fix union all instance number #39999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
88 changes: 88 additions & 0 deletions
88
regression-test/suites/query_p0/union/test_union_instance.groovy
This file contains hidden or 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,88 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| suite("test_union_instance") { | ||
| multi_sql """ | ||
| drop table if exists t1; | ||
| drop table if exists t2; | ||
| drop table if exists t3; | ||
| drop table if exists t4; | ||
| CREATE TABLE `t1` ( | ||
| `c1` int NULL, | ||
| `c2` int NULL, | ||
| `c3` int NULL | ||
| ) ENGINE=OLAP | ||
| DUPLICATE KEY(`c1`, `c2`, `c3`) | ||
| DISTRIBUTED BY HASH(`c1`) BUCKETS 3 | ||
| PROPERTIES ( | ||
| "replication_allocation" = "tag.location.default: 1"); | ||
|
|
||
| insert into t1 values (1,1,1); | ||
| insert into t1 values (2,2,2); | ||
| insert into t1 values (3,3,3); | ||
|
|
||
| CREATE TABLE `t2` ( | ||
| `year_week` varchar(45) NULL | ||
| ) ENGINE=OLAP | ||
| DUPLICATE KEY(`year_week`) | ||
| DISTRIBUTED BY HASH(`year_week`) BUCKETS 1 | ||
| PROPERTIES ( | ||
| "replication_allocation" = "tag.location.default: 1"); | ||
|
|
||
| CREATE TABLE `t3` ( | ||
| `unique_key` varchar(2999) NULL, | ||
| `brand_name` varchar(96) NULL, | ||
| `skc` varchar(150) NULL | ||
| ) ENGINE=OLAP | ||
| UNIQUE KEY(`unique_key`) | ||
| DISTRIBUTED BY HASH(`unique_key`) BUCKETS 20 | ||
| PROPERTIES ( | ||
| "replication_allocation" = "tag.location.default: 1"); | ||
|
|
||
| CREATE TABLE `t4` ( | ||
| `skc_code` varchar(150) NULL | ||
| ) ENGINE=OLAP | ||
| UNIQUE KEY(`skc_code`) | ||
| DISTRIBUTED BY HASH(`skc_code`) BUCKETS 1 | ||
| PROPERTIES ( | ||
| "replication_allocation" = "tag.location.default: 1"); | ||
|
|
||
| set parallel_pipeline_task_num=1; | ||
| set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; | ||
| """ | ||
| explain { | ||
| sql """ | ||
| SELECT `t`.`year_week` AS `year_week` | ||
| ,'' AS `brand_name` | ||
| , '' AS `skc_code` | ||
| FROM `t1` a | ||
| CROSS JOIN `t2` t | ||
| union all | ||
| SELECT '1' AS `year_week` | ||
| ,`a`.`brand_name` AS `brand_name` | ||
| ,`a`.`skc` AS `skc_code` | ||
| FROM `t3` a | ||
| INNER JOIN[shuffle] `t4` b ON `a`.`skc` = `b`.`skc_code` | ||
| GROUP BY 1, 2, 3; | ||
| """ | ||
| contains "3:VNESTED LOOP JOIN" | ||
| contains "4:VEXCHANGE" | ||
| contains "8:VEXCHANGE" | ||
| contains "6:VEXCHANGE" | ||
| contains "11:VUNION" | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.