[CALCITE-7757] RelMdFunctionalDependency can infer unsound dependencies and cause incorrect query results - #5235
Open
darpan-14 wants to merge 6 commits into
Open
[CALCITE-7757] RelMdFunctionalDependency can infer unsound dependencies and cause incorrect query results#5235darpan-14 wants to merge 6 commits into
darpan-14 wants to merge 6 commits into
Conversation
Contributor
|
CI doesn't like your changes |
darpan-14
force-pushed
the
CALCITE-7757
branch
from
September 1, 2026 06:04
32526d0 to
60bf738
Compare
Contributor
Author
|
CI is happy now. 😄 |
|
mihaibudiu
reviewed
Sep 2, 2026
| * determines another. Approximate numerics and intervals are unsafe, | ||
| * including when nested in rows, collections, or maps. | ||
| */ | ||
| private static boolean typeSupportsGroupKeyInference(RelDataType type) { |
Contributor
There was a problem hiding this comment.
why are intervals unsafe?
Contributor
Author
There was a problem hiding this comment.
They are safe, it was an oversight from my side 😓
I see Calcite normalises intervals under the hood. I will remove this check for intervals.
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.



Jira Link
CALCITE-7757
Changes Proposed
RelMdFunctionalDependency can currently expose unsound or incorrectly indexed dependencies, allowing AggregateRemoveDuplicateKeysRule to remove grouping keys that are still required.
This change:
A basic valid duplicate-key removal remains supported:
For this inner join, either equivalent equality key may be removed. The new safeguards prevent that reasoning from being applied where null generation, ordinal mapping, or non-reflexive type semantics make it unsound.
Testing
The focused test run completed 49 tests with 0 failures.