fix: infer placeholder types in GROUP BY, HAVING, QUALIFY and ORDER BY (fix for #24042) - #24043
Open
Braedon-Wooding-Displayr wants to merge 1 commit into
Open
Conversation
The SELECT list is planned by sql_to_expr, which infers placeholder types. These four clauses are planned by sql_expr_to_logical_expr, which does not, so the same expression written in both places does not compare equal. The result is that a grouping key containing a placeholder is never matched against the identical SELECT expression, and the columns inside it are reported as ungrouped. The same query with literals in place of the placeholder plans fine. QUALIFY fails differently, on a duplicate field name, because the typed and untyped spellings print alike but are not equal. Adds a planner test per clause.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24043 +/- ##
==========================================
- Coverage 80.85% 80.85% -0.01%
==========================================
Files 1101 1101
Lines 375467 375481 +14
Branches 375467 375481 +14
==========================================
+ Hits 303596 303600 +4
- Misses 53777 53778 +1
- Partials 18094 18103 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Author
|
Most of the missing coverage seems to just be error propagation? Which should be okay. |
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.
The SELECT list is planned by sql_to_expr, which infers placeholder types. These four clauses are planned by sql_expr_to_logical_expr, which does not, so the same expression written in both places does not compare equal.
The result is that a grouping key containing a placeholder is never matched against the identical SELECT expression, and the columns inside it are reported as ungrouped. The same query with literals in place of the placeholder plans fine. QUALIFY fails differently, on a duplicate field name, because the typed and untyped spellings print alike but are not equal.
Adds a planner test per clause.
Which issue does this PR close?
Rationale for this change
I think it's clearly explained above / in issue.
What changes are included in this PR?
New tests for each clause case + inferring types in the clauses.
Are these changes tested?
Yes tests are there.
Are there any user-facing changes?
No.