Skip to content

[FLINK-40250][table] Throw ValidationException for non-orderable types used as keys - #28834

Merged
gustavodemorais merged 1 commit into
apache:masterfrom
confluentinc:FLINK-40250
Jul 29, 2026
Merged

[FLINK-40250][table] Throw ValidationException for non-orderable types used as keys#28834
gustavodemorais merged 1 commit into
apache:masterfrom
confluentinc:FLINK-40250

Conversation

@gustavodemorais

Copy link
Copy Markdown
Contributor

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

  • Throw ValidationException instead of UnsupportedOperationException for non-orderable types in GenerateUtils.generateCompare, with a message that names the type and the remedy.
  • Update CalcITCase and BitmapSemanticTest to expect ValidationException and the new message.
  • Remove the now-unused UnsupportedOperationException allowance from FailingSqlTestStep.

Verifying this change

  • CalcITCase
  • BitmapSemanticTest

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable)

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

2.1.220 (Claude Code) with Opus 4.8

…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.
@flinkbot

flinkbot commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be TableRuntimeException?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just compare javadoc


vs
* Exception for all errors occurring during validation phase.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we are not in execution yet. This is still plan / job graph preparation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@twalthr twalthr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gustavodemorais
gustavodemorais merged commit 04bfaff into apache:master Jul 29, 2026
@gustavodemorais
gustavodemorais deleted the FLINK-40250 branch July 29, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants