Skip to content

Commit dfeac1d

Browse files
committed
Fixed bug in cross product rewriting that resulted in conditions being pushed to deep. Also added MIT License.
1 parent 2b93926 commit dfeac1d

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

LICENSE

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2018 DuckDB Contributors (see https://github.com/cwida/duckdb/graphs/contributors)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

src/planner/operator/logical_join.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ JoinSide LogicalJoin::GetJoinSide(LogicalOperator *op,
1919
colref->binding.table_index) !=
2020
op->children[0]->referenced_tables.end()) {
2121
return JoinSide::LEFT;
22+
} else if (op->children[1]->referenced_tables.find(
23+
colref->binding.table_index) !=
24+
op->children[1]->referenced_tables.end()) {
25+
return JoinSide::RIGHT;
2226
} else {
23-
if (op->children[1]->referenced_tables.find(
24-
colref->binding.table_index) !=
25-
op->children[1]->referenced_tables.end()) {
26-
return JoinSide::RIGHT;
27-
} else {
28-
return JoinSide::NONE;
29-
}
27+
// if its neither in left nor right its both not none
28+
return JoinSide::BOTH;
3029
}
30+
3131
} else {
3232
JoinSide join_side = JoinSide::NONE;
3333
for (auto &child : expr->children) {

test/sql/tpcds/tpcds.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ TEST_CASE("Test TPC-DS SF0 Query Compilation", "[tpcds]") {
1515

1616
// this is to make sure we do not get regressions in query compilation
1717
vector<size_t> compiling_queries = {
18-
1, 2, 3, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20,
19-
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 40,
20-
41, 42, 43, 44, 46, 47, 49, 50, 52, 54, 56, 58, 59, 60, 62, 63, 64,
21-
65, 66, 68, 69, 70, 72, 73, 75, 76, 77, 79, 80, 81, 82, 83, 84, 85,
22-
86, 87, 88, 89, 91, 92, 94, 95, 96, 97, 98, 99, 100, 101, 103};
18+
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16,
19+
17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
20+
33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 46, 47, 49, 50,
21+
52, 54, 56, 58, 59, 60, 62, 63, 64, 65, 66, 68, 69, 70, 72,
22+
73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
23+
89, 91, 92, 94, 95, 96, 97, 98, 99, 100, 101, 103};
2324
for (size_t q : compiling_queries) {
2425
result = con.Query(tpcds::get_query(q));
2526
REQUIRE(result->success);

0 commit comments

Comments
 (0)