-
Notifications
You must be signed in to change notification settings - Fork 26
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
Subquery Unnesting Agg NULL case workarounds #257
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
99ed87e
Add all tpch queries (from risinglightdb tests)
jurplel 5e4f33a
Newline normalization
jurplel 298ab67
Fix BinOp schema property issue
jurplel 6547052
tpch q11 fix
jurplel b62ce72
Merge branch 'bowad/tpch-q11-fix' of github.com:cmu-db/optd into bowa…
jurplel 768982d
Update sqlplannertest plans
jurplel 52359fa
Merge branch 'main' into bowad/tpch-q11-fix
jurplel 01774d1
Delete q11 again
jurplel 4c2c7fd
fix a couple of depjoin agg pushdown bugs
jurplel 66a310d
un-disable tpch-q17
jurplel 21d490a
Fix another bug w/ init distinct
jurplel f4108b3
Write comment for init distinct fix
jurplel a945abf
Merge
jurplel f055605
Update sqlplannertest plans
jurplel 0dcce3d
Add test for out-of-order extern columns in subquery
jurplel b468692
add unnest test w/ nulls from agg
jurplel 78c2b5e
Implement outer join agg null fix
jurplel 9edf1af
Count(*) fix
jurplel bab134f
Merge branch 'main' into bowad/unnest-agg-null-fix
jurplel b0b9e4e
planner test updates
jurplel 9778e25
clippy
jurplel 87c9c09
Unused variable
jurplel c2c908e
Fix NULL not printing
jurplel b9c70ee
merge w/ main (and tests are failing)
jurplel 0fc8cb9
Fix not passing all columns through (I think this was a bug?)
jurplel c2082da
clippy
jurplel 34d6d88
Add comment to projection
jurplel e8b1d5b
Remove extraneous sqlplannertest result
jurplel b7a18f4
Grammar fix in test files
jurplel 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
include _basic_tables.slt.part | ||
|
||
# This query has NULL values from the subquery agg. It won't work without the | ||
# outer join fix. | ||
# It also has an out-of-order extern column [#1] | ||
query | ||
select | ||
v1, | ||
v2, | ||
( | ||
select avg(v4) | ||
from t2 | ||
where v4 = v2 | ||
) as avg_v4 | ||
from t1 order by v1; | ||
---- | ||
1 100 NULL | ||
2 200 200.0 | ||
2 250 250.0 | ||
3 300 300.0 | ||
3 300 300.0 |
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,22 @@ | ||
include _basic_tables.slt.part | ||
|
||
# This query uses a count(*) agg function, with nulls. Nulls should be | ||
# transformed from NULL to 0 when they come from count(*). | ||
# It won't work without the outer join fix + a special case on count(*). | ||
# It also has an out-of-order extern column [#1] | ||
query | ||
select | ||
v1, | ||
v2, | ||
( | ||
select count(*) | ||
from t2 | ||
where v4 = v2 | ||
) as avg_v4 | ||
from t1 order by v1; | ||
---- | ||
1 100 0 | ||
2 200 1 | ||
2 250 1 | ||
3 300 1 | ||
3 300 1 |
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
Oops, something went wrong.
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.
This is one thing I am not sure of the correctness of.
The meaning is to take:
I found this to be correct in all the tests that I wrote.
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.
Maybe we need to figure out the exact meaning of this -- do you want to know if two columns refer to the same table-column?
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.
Okay, so after thinking about it a bit longer, my description is correct, but it is a bit easier to think about than that:
The right side is going to be the subquery on the right, and the deduplicated part on the left.
The left side is going to be a copy of the deduplicated part that is the left child of the right child.
So, our projection will be the deduplicated copy (that will be outer joined to resolve the null problems) and the non-deduplicated part from the right side.