-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fix derived table bug #15831
Merged
Merged
Fix derived table bug #15831
Conversation
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
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
vitess-bot
bot
added
NeedsBackportReason
If backport labels have been applied to a PR, a justification is required
NeedsDescriptionUpdate
The description is not clear or comprehensive enough, and needs work
NeedsIssue
A linked issue is missing for this Pull Request
NeedsWebsiteDocsUpdate
What it says
labels
May 2, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15831 +/- ##
==========================================
+ Coverage 68.41% 68.44% +0.02%
==========================================
Files 1558 1559 +1
Lines 196353 196511 +158
==========================================
+ Hits 134337 134501 +164
+ Misses 62016 62010 -6 ☔ View full report in Codecov by Sentry. |
…tain the correct routing information Signed-off-by: Manan Gupta <manan@planetscale.com>
…pe mismatch Signed-off-by: Manan Gupta <manan@planetscale.com>
GuptaManan100
added
Type: Bug
Component: Query Serving
and removed
NeedsDescriptionUpdate
The description is not clear or comprehensive enough, and needs work
NeedsWebsiteDocsUpdate
What it says
NeedsIssue
A linked issue is missing for this Pull Request
NeedsBackportReason
If backport labels have been applied to a PR, a justification is required
labels
May 2, 2024
GuptaManan100
requested review from
harshit-gangal,
systay,
frouioui and
arthurschreiber
as code owners
May 2, 2024 17:51
frouioui
approved these changes
May 2, 2024
Signed-off-by: Manan Gupta <manan@planetscale.com>
dbussink
approved these changes
May 3, 2024
systay
approved these changes
May 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR fixes the issue described in #15830.
While working on fixing the derived table query, it was noticed that
select * from (select u.foo * ue.bar from user u join user_extra ue) as dt
wasn't working on main even before #15588 was merged but still #15588 made it worse (as in the plan became even more wrong if that makes sense).This PR fixes this issue and after the changes in this PR, that query works as intended. There are 2 changes in this PR -
We can't override the original expression when we see a derived table, because overriding the original with a column name causes issues with breaking the expression since a column name can't be split. At the same time, we don't want to lose the information about the column name either. So we now store this information in a newly introduced field called
DTColumn
. We further change planning of offsets to check for theDTColumn
value. Since we know the underlying source has a field with this name, we get it from there.The other bug present in
main
even before Make sure derived table column names are handled correctly #15588 was merged, was around projection pushing wherein a new projection would totally override the join columns. This led to the information about the splitting of columns being forgotten and then the same problem wherein we can't split an aliased expression. The fix is to just reuse the joinColumns if they're already populated.Related Issue(s)
Checklist
Deployment Notes