fix: do not prune ORDER BY keys using nullable UNIQUE constraints#23918
Open
buraksenn wants to merge 1 commit into
Open
fix: do not prune ORDER BY keys using nullable UNIQUE constraints#23918buraksenn wants to merge 1 commit into
buraksenn wants to merge 1 commit into
Conversation
buraksenn
commented
Jul 27, 2026
| #[derive(Debug, Clone, PartialEq, Eq)] | ||
| pub struct FunctionalDependencies { | ||
| deps: Vec<FunctionalDependence>, | ||
| null_equalities: Vec<NullEquality>, |
Contributor
Author
There was a problem hiding this comment.
this can be added in FunctionalDependence but since that is pub as well I did not want to change this. I can add this field into that struct if that makes more sense
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #23918 +/- ##
=========================================
Coverage 80.65% 80.66%
=========================================
Files 1092 1095 +3
Lines 371140 372344 +1204
Branches 371140 372344 +1204
=========================================
+ Hits 299353 300361 +1008
- Misses 53933 54063 +130
- Partials 17854 17920 +66 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Which issue does this PR close?
Rationale for this change
Please check the issue for details, but the main idea is that a nullable
UNIQUEcolumn permits multiple NULL rows, so it does not determine later sort keys across them and they must not be pruned.What changes are included in this PR?
FunctionalDependenciestracks aNullEqualityper dependency. Sort-key pruning now requires the determinant to treat NULLs as equal (GROUP BY key), be non-nullable, or haveNOT NULLsources.Are these changes tested?
Yes, regression tests added in
functional_dependencies.slt.Are there any user-facing changes?
No API changes; incorrect results are fixed.