forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix)(colocate join) fix wrong use of colocate join (apache#37361)
- Loading branch information
Showing
5 changed files
with
137 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
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
82 changes: 82 additions & 0 deletions
82
regression-test/suites/correctness_p0/test_colocate_join_of_column_order.groovy
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,82 @@ | ||
// 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_colocate_join_of_column_order") { | ||
sql """ DROP TABLE IF EXISTS `test_colocate_join_of_column_order_t1`; """ | ||
// distributed by k1,k2 | ||
sql """ | ||
CREATE TABLE IF NOT EXISTS `test_colocate_join_of_column_order_t1` ( | ||
`k1` varchar(64) NULL, | ||
`k2` varchar(64) NULL, | ||
`v` int NULL | ||
) ENGINE=OLAP | ||
DUPLICATE KEY(`k1`,`k2`) | ||
COMMENT 'OLAP' | ||
DISTRIBUTED BY HASH(`k1`,`k2`) BUCKETS 1 | ||
PROPERTIES ( | ||
"replication_num" = "1", | ||
"colocate_with" = "group_column_order" | ||
); | ||
""" | ||
sql """ DROP TABLE IF EXISTS `test_colocate_join_of_column_order_t2`; """ | ||
// distributed by k2,k1 | ||
sql """ | ||
CREATE TABLE IF NOT EXISTS `test_colocate_join_of_column_order_t2` ( | ||
`k1` varchar(64) NULL, | ||
`k2` varchar(64) NULL, | ||
`v` int NULL | ||
) ENGINE=OLAP | ||
DUPLICATE KEY(`k1`,`k2`) | ||
COMMENT 'OLAP' | ||
DISTRIBUTED BY HASH(`k2`,`k1`) BUCKETS 1 | ||
PROPERTIES ( | ||
"replication_num" = "1", | ||
"colocate_with" = "group_column_order" | ||
); | ||
""" | ||
sql """insert into test_colocate_join_of_column_order_t1 values('k1','k2',11);""" | ||
sql """insert into test_colocate_join_of_column_order_t2 values('k1','k2',11);""" | ||
|
||
sql """set enable_nereids_planner=true; """ | ||
explain { | ||
sql("select * from test_colocate_join_of_column_order_t1 a join test_colocate_join_of_column_order_t2 b on a.k1=b.k1 and a.k2=b.k2;") | ||
notContains "COLOCATE" | ||
} | ||
explain { | ||
sql("select * from test_colocate_join_of_column_order_t1 a join test_colocate_join_of_column_order_t2 b on a.k1=b.k2;") | ||
notContains "COLOCATE" | ||
} | ||
explain { | ||
sql("select * from test_colocate_join_of_column_order_t1 a join test_colocate_join_of_column_order_t2 b on a.k1=b.k1;") | ||
notContains "COLOCATE" | ||
} | ||
explain { | ||
sql("select * from test_colocate_join_of_column_order_t1 a join test_colocate_join_of_column_order_t2 b on a.k1=b.k2 and a.v=b.v;") | ||
notContains "COLOCATE" | ||
} | ||
explain { | ||
sql("select * from test_colocate_join_of_column_order_t1 a join test_colocate_join_of_column_order_t2 b on a.k1=b.k2 and a.k2=b.k1;") | ||
contains "COLOCATE" | ||
} | ||
explain { | ||
sql("select * from test_colocate_join_of_column_order_t1 a join test_colocate_join_of_column_order_t2 b on a.k1=b.k2 and a.k2=b.k1 and a.v=b.v;") | ||
contains "COLOCATE" | ||
} | ||
|
||
sql """ DROP TABLE IF EXISTS `test_colocate_join_of_column_order_t1`; """ | ||
sql """ DROP TABLE IF EXISTS `test_colocate_join_of_column_order_t2`; """ | ||
} |