[FLINK-40250][table] Throw ValidationException for non-orderable types used as keys - #28834
Merged
Merged
Conversation
…s used as keys GenerateUtils#generateCompare threw a raw UnsupportedOperationException when a non-orderable type (MAP, MULTISET, VARIANT, TIMESTAMP_WITH_TIME_ZONE, BITMAP) was used as an ordering, grouping, or join key. This is invalid user SQL, so it now throws a ValidationException with a clearer message, consistent with the equality comparison path in ScalarOperatorGens.
Collaborator
snuyanzin
reviewed
Jul 28, 2026
| throw new UnsupportedOperationException( | ||
| s"Type($t) is not an orderable data type, " + | ||
| s"it is not supported as a ORDER_BY/GROUP_BY/JOIN_EQUAL field.") | ||
| throw new ValidationException( |
Contributor
There was a problem hiding this comment.
shouldn't it be TableRuntimeException?
Contributor
There was a problem hiding this comment.
Contributor
There was a problem hiding this comment.
No, we are not in execution yet. This is still plan / job graph preparation.
Contributor
Author
There was a problem hiding this comment.
I thought a bit about this and it's a deterministic error that will be thrown during validation time, so I think validation is the right call as well
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.
What is the purpose of the change
Using a non-orderable type (MAP, MULTISET, VARIANT, BITMAP, TIMESTAMP_WITH_TIME_ZONE) as a sort, grouping, or join key threw a raw UnsupportedOperationException from comparator code generation. This changes it to a ValidationException with a clearer, actionable message, since it is invalid user SQL rather than an internal error.
Brief change log
Verifying this change
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation
Was generative AI tooling used to co-author this PR?
2.1.220 (Claude Code) with Opus 4.8