[CALCITE-7706] ARG_MIN ignores nullability of second argument - #5173
Merged
Conversation
xuzifu666
approved these changes
Aug 11, 2026
xuzifu666
left a comment
Member
There was a problem hiding this comment.
LGTM, only add a comment for QuidemTest.
| # Rows whose comparator is NULL are skipped, so a group where every | ||
| # comparator value is NULL yields NULL even though the value argument | ||
| # is NOT NULL. | ||
| select g, arg_min(v, c) as r |
Member
There was a problem hiding this comment.
agg.iq only tested the runtime behavior of ARG_MIN and not ARG_MAX; although the logic is symmetrical, it would be good to add the missing test case(This revision also involves arg_max).
Contributor
Author
|
I have extended both quidem tests to do both ARG_MAX and ARG_MIN. |
Signed-off-by: Mihai Budiu <mbudiu@feldera.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.



CALCITE-7706
Changes Proposed
Type inference for ARG_MIN/ARG_MAX needs to check whether the second argument is nullable. It only used to check the first argument. This could lead to incorrect results or crashes at runtime.