-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add rule to reimplement Eliminate cross join and remove it in planner
#4185
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
7 commits
Select commit
Hold shift + click to select a range
5d864ec
reimplement eliminate_cross_join
jackwener 5b023f0
add test for subquery alias and projection alias.
jackwener 1e5955e
add test
jackwener d36abd5
fix fmt
jackwener 6176f1f
review
jackwener fb12fed
fmt
jackwener 2e7a4c4
fix conflict
jackwener 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,25 @@ | ||
| Sort: supplier.s_acctbal DESC NULLS FIRST, nation.n_name ASC NULLS LAST, supplier.s_name ASC NULLS LAST, part.p_partkey ASC NULLS LAST | ||
| Projection: supplier.s_acctbal, supplier.s_name, nation.n_name, part.p_partkey, part.p_mfgr, supplier.s_address, supplier.s_phone, supplier.s_comment | ||
| Inner Join: part.p_partkey = __sq_1.ps_partkey, partsupp.ps_supplycost = __sq_1.__value | ||
| Inner Join: nation.n_regionkey = region.r_regionkey | ||
| Inner Join: supplier.s_nationkey = nation.n_nationkey | ||
| Inner Join: partsupp.ps_suppkey = supplier.s_suppkey | ||
| Inner Join: part.p_partkey = partsupp.ps_partkey | ||
| Filter: part.p_size = Int32(15) AND part.p_type LIKE Utf8("%BRASS") | ||
| TableScan: part projection=[p_partkey, p_mfgr, p_type, p_size] | ||
| TableScan: partsupp projection=[ps_partkey, ps_suppkey, ps_supplycost] | ||
| TableScan: supplier projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment] | ||
| TableScan: nation projection=[n_nationkey, n_name, n_regionkey] | ||
| Filter: region.r_name = Utf8("EUROPE") | ||
| TableScan: region projection=[r_regionkey, r_name] | ||
| Projection: partsupp.ps_partkey, MIN(partsupp.ps_supplycost) AS __value, alias=__sq_1 | ||
| Aggregate: groupBy=[[partsupp.ps_partkey]], aggr=[[MIN(partsupp.ps_supplycost)]] | ||
| Inner Join: nation.n_regionkey = region.r_regionkey | ||
| Inner Join: supplier.s_nationkey = nation.n_nationkey | ||
| Inner Join: partsupp.ps_suppkey = supplier.s_suppkey | ||
| Projection: part.p_partkey, part.p_mfgr, supplier.s_name, supplier.s_address, supplier.s_phone, supplier.s_acctbal, supplier.s_comment, nation.n_name | ||
| Inner Join: part.p_partkey = __sq_1.ps_partkey, partsupp.ps_supplycost = __sq_1.__value | ||
| Inner Join: nation.n_regionkey = region.r_regionkey | ||
| Inner Join: supplier.s_nationkey = nation.n_nationkey | ||
| Inner Join: partsupp.ps_suppkey = supplier.s_suppkey | ||
| Inner Join: part.p_partkey = partsupp.ps_partkey | ||
| Filter: part.p_size = Int32(15) AND part.p_type LIKE Utf8("%BRASS") | ||
| TableScan: part projection=[p_partkey, p_mfgr, p_type, p_size] | ||
| TableScan: partsupp projection=[ps_partkey, ps_suppkey, ps_supplycost] | ||
| TableScan: supplier projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment] | ||
| TableScan: nation projection=[n_nationkey, n_name, n_regionkey] | ||
| Filter: region.r_name = Utf8("EUROPE") | ||
| TableScan: region projection=[r_regionkey, r_name] | ||
| TableScan: supplier projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment] | ||
| TableScan: nation projection=[n_nationkey, n_name, n_regionkey] | ||
| Filter: region.r_name = Utf8("EUROPE") | ||
| TableScan: region projection=[r_regionkey, r_name] | ||
| Projection: partsupp.ps_partkey, MIN(partsupp.ps_supplycost) AS __value, alias=__sq_1 | ||
| Aggregate: groupBy=[[partsupp.ps_partkey]], aggr=[[MIN(partsupp.ps_supplycost)]] | ||
| Inner Join: nation.n_regionkey = region.r_regionkey | ||
| Inner Join: supplier.s_nationkey = nation.n_nationkey | ||
| Inner Join: partsupp.ps_suppkey = supplier.s_suppkey | ||
| TableScan: partsupp projection=[ps_partkey, ps_suppkey, ps_supplycost] | ||
| TableScan: supplier projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment] | ||
| TableScan: nation projection=[n_nationkey, n_name, n_regionkey] | ||
| Filter: region.r_name = Utf8("EUROPE") | ||
| TableScan: region projection=[r_regionkey, r_name] | ||
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
Oops, something went wrong.
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.
I found the difference much easier to see with whitespace blind diff
https://github.com/apache/arrow-datafusion/pull/4185/files?w=1
I found github's rendering of this really hard to understand the change in plan -- I drew out the join graphs by hand to make sure they were the same.