fix: handle aliases in UNIONs better#18484
Merged
systay merged 1 commit intovitessio:mainfrom Jul 24, 2025
Merged
Conversation
Signed-off-by: Andres Taylor <andres@planetscale.com>
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
|
dbussink
approved these changes
Jul 24, 2025
| offset := slices.IndexFunc(cols, func(expr *sqlparser.AliasedExpr) bool { | ||
| return e.Name.EqualString(expr.ColumnName()) | ||
| offset := slices.IndexFunc(cols, func(column *sqlparser.AliasedExpr) bool { | ||
| if column.ColumnName() == expr.ColumnName() { |
Member
There was a problem hiding this comment.
I had to double check, but this looks to work also correctly if both sides don't have an alias set?
Collaborator
Author
There was a problem hiding this comment.
exactly. we have tests of both variations.
frouioui
approved these changes
Jul 24, 2025
Contributor
|
Should this be backported? |
Collaborator
Author
I believe the rule is to only backport regressions or corruption bugs (corrupted data, but also corrupted results). Since this "just" fails to plan, we don't backport |
morgo
added a commit
to morgo/vitess
that referenced
this pull request
Jul 29, 2025
…rds-new2 * origin/master: Set up better dependency checks (vitessio#18508) bugfix: Plan group by only on top of derived tables correctly (vitessio#18505) Fix regression in v22 around new flag setup (vitessio#18507) Bump form-data from 4.0.1 to 4.0.4 in /web/vtadmin (vitessio#18473) Bump @babel/runtime from 7.26.0 to 7.27.6 in /web/vtadmin (vitessio#18467) Bump vite from 4.5.9 to 4.5.14 in /web/vtadmin (vitessio#18485) Fix for simple projection showing no fields (vitessio#18489) log.Info -> log.Infof in tabletserver for reloading ACLs (vitessio#18461) Fix scalar aggregation with literals in empty result sets (vitessio#18477) Avoid terminating atomic copy workflows on error if they are out of copy phase (vitessio#18475) Update runners to use cncf oracle vms (vitessio#18425) fix: handle aliases in UNIONs better (vitessio#18484) VReplication: Fix bug while reading _vt.vreplication record (vitessio#18478) Planner: Add comprehensive debug logging for query planner NoRewrite cases (vitessio#18476) Update email in Maintainers file (vitessio#18472) tablet manager's `ExecuteFetchAsDba` does not allow multiple queries (vitessio#18183) Signed-off-by: Morgan Tocker <tocker@gmail.com>
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
When planning UNIONs, Vitess was having a hard time handling column aliases correctly.
Related Issue(s)
Fixes #18469
Checklist