Skip to content

[FLINK-40556][table] Support UUID value literals backed by byte[] values - #29153

Open
raminqaf wants to merge 1 commit into
apache:masterfrom
raminqaf:FLINK-40556
Open

[FLINK-40556][table] Support UUID value literals backed by byte[] values#29153
raminqaf wants to merge 1 commit into
apache:masterfrom
raminqaf:FLINK-40556

Conversation

@raminqaf

Copy link
Copy Markdown
Contributor

What is the purpose of the change

UuidType allows both UUID and byte[] as conversion classes, so a ValueLiteralExpression can legally hold a UUID literal internally as a byte[]. ValueLiteralExpression#getValueAs(UUID.class) didn't handle that case and returned empty, so both asSerializableString and ExpressionConverter threw NoSuchElementException/IllegalStateException instead of producing a literal.

Brief change log

  • Added a byte[] to UUID conversion arm in ValueLiteralExpression#getValueAs, matching the existing coercion pattern for LocalDate, Instant, and other multi-representation types.
  • Fixes both affected call sites (asSerializableString and ExpressionConverter#visit) with a single change, since both go through getValueAs.

Verifying this change

This change added tests and can be verified as follows:

  • ExpressionTest#testUuidValueLiteralExtraction and #testUuidAsSerializableString are parameterized over a direct UUID literal and a byte[]-bridged literal.
  • ExpressionConverterTest#testUuidLiteral and #testUuidLiteralFromBytes cover the same two cases through the planner's RexNode conversion path.
  • All four byte[]-backed cases reproduce the original exception before the fix and pass after it.

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

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

Generated-by: Claude Code (Sonnet 5)

UuidType allows both UUID and byte[] as conversion classes, so a ValueLiteralExpression can legally hold a UUID literal as a byte[] value. ValueLiteralExpression#getValueAs(UUID.class) did not handle that case and returned empty, so asSerializableString and ExpressionConverter threw NoSuchElementException or IllegalStateException instead of producing a literal.

Add a byte[] to UUID conversion arm to getValueAs, matching the existing coercion pattern for LocalDate, Instant, and other multi-representation types. This single fix covers both call sites since they both go through getValueAs.

@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

@flinkbot

flinkbot commented Sep 10, 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

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.

3 participants