-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Enforce JOIN plan to require condition #15334
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
8 commits
Select commit
Hold shift + click to select a range
a5b5591
add check for missing join condition
goldmedal 42a4115
modify the tests
goldmedal 189e506
handle the cross join case
goldmedal eee2223
remove invald sql case
goldmedal 0449f0f
fix sqllogictests
goldmedal c7dc734
fix for cross join case
goldmedal 0eb4cfa
revert the change for limit.slt
goldmedal 7765900
add cross join test
goldmedal 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
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
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
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
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 |
---|---|---|
|
@@ -625,6 +625,28 @@ FROM t1 | |
---- | ||
11 11 11 | ||
|
||
# join condition is required | ||
# TODO: query error join condition should not be empty | ||
# related to: https://github.com/apache/datafusion/issues/13486 | ||
statement ok | ||
SELECT * FROM t1 JOIN t2 | ||
|
||
# join condition is required | ||
query error join condition should not be empty | ||
SELECT * FROM t1 LEFT JOIN t2 | ||
|
||
# join condition is required | ||
query error join condition should not be empty | ||
SELECT * FROM t1 RIGHT JOIN t2 | ||
|
||
# join condition is required | ||
query error join condition should not be empty | ||
SELECT * FROM t1 FULL JOIN t2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please include also a cross join without filters like
|
||
|
||
# cross join no need for join condition | ||
statement ok | ||
SELECT * FROM t1 CROSS JOIN t2 | ||
|
||
# multiple inner joins with mixed ON clause and filter | ||
query III rowsort | ||
SELECT t1.t1_id, t2.t2_id, t3.t3_id | ||
|
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
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
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 |
---|---|---|
|
@@ -65,7 +65,7 @@ logical_plan | |
07)------------Projection: customer.c_phone, customer.c_acctbal | ||
08)--------------LeftAnti Join: customer.c_custkey = __correlated_sq_1.o_custkey | ||
09)----------------Filter: substr(customer.c_phone, Int64(1), Int64(2)) IN ([Utf8View("13"), Utf8View("31"), Utf8View("23"), Utf8View("29"), Utf8View("30"), Utf8View("18"), Utf8View("17")]) | ||
10)------------------TableScan: customer projection=[c_custkey, c_phone, c_acctbal], partial_filters=[substr(customer.c_phone, Int64(1), Int64(2)) IN ([Utf8View("13"), Utf8View("31"), Utf8View("23"), Utf8View("29"), Utf8View("30"), Utf8View("18"), Utf8View("17")])] | ||
10)------------------TableScan: customer projection=[c_custkey, c_phone, c_acctbal], partial_filters=[substr(customer.c_phone, Int64(1), Int64(2)) IN ([Utf8View("13"), Utf8View("31"), Utf8View("23"), Utf8View("29"), Utf8View("30"), Utf8View("18"), Utf8View("17")]), Boolean(true)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I benchmarked to ensure the plan change won't impact the performance.
|
||
11)----------------SubqueryAlias: __correlated_sq_1 | ||
12)------------------TableScan: orders projection=[o_custkey] | ||
13)------------SubqueryAlias: __scalar_sq_2 | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case has never occurred now.