Column alias expanding on ORDER BY#15302
Merged
systay merged 12 commits intovitessio:mainfrom Feb 22, 2024
Merged
Conversation
Contributor
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
|
b2a3c84 to
335b75a
Compare
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
0d74fe4 to
cb1684d
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #15302 +/- ##
==========================================
+ Coverage 67.53% 67.64% +0.10%
==========================================
Files 1561 1561
Lines 193387 193535 +148
==========================================
+ Hits 130607 130913 +306
+ Misses 62780 62622 -158 ☔ View full report in Codecov by Sentry. |
…one order by path Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
dbussink
reviewed
Feb 21, 2024
|
|
||
| func TestOrderByComplex(t *testing.T) { | ||
| // tests written to try to trick the ORDER BY engine and planner | ||
| utils.SkipIfBinaryIsBelowVersion(t, 20, "vtgate") |
Member
There was a problem hiding this comment.
Should we change this once back ported? Since I think we need to back port this to v19 too since that has the previous PR and otherwise we have a significant regression?
dbussink
approved these changes
Feb 21, 2024
Signed-off-by: Manan Gupta <manan@planetscale.com>
GuptaManan100
approved these changes
Feb 22, 2024
systay
added a commit
that referenced
this pull request
Feb 22, 2024
Co-authored-by: Harshit Gangal <harshit@planetscale.com> Co-authored-by: Manan Gupta <manan@planetscale.com> Signed-off-by: Andres Taylor <andres@planetscale.com>
systay
added a commit
to planetscale/vitess
that referenced
this pull request
Feb 22, 2024
Signed-off-by: Andres Taylor <andres@planetscale.com>
dbussink
pushed a commit
that referenced
this pull request
Feb 22, 2024
dbussink
pushed a commit
that referenced
this pull request
Feb 22, 2024
5 tasks
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
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
In a recent PR, I did some work on how to rewrite column aliases used in ORDER BY, GROUP BY and HAVING.
I did not get that right, and introduced issues for a set of queries. This PR tries to correctly rewrite more column using the same rules that MySQL has.
Rewrite rules
Terminology first: an expression in the
SELECTclause is a SELECT-expression. These can have aliased.An ORDER BY expression is an expression listed in the ORDER BY clause, without the ASC/DESC modifier.
Rewrite rule:
An unqualified column name in the ORDER BY that matches an alias among the SELECT expressions will be replaced with the SELECT expression if:
Related Issue(s)
Original PR #14935
Checklist
Deployment Notes