[FLINK-39801][table] Skip serializing empty partition/order keys for PTF table args#28283
Merged
Conversation
1 task
Collaborator
snuyanzin
reviewed
May 30, 2026
| } | ||
| } else { | ||
| order = new SortOrder[0]; | ||
| private static <T> List<T> deserializeArrayOrEmpty( |
Contributor
There was a problem hiding this comment.
Why is it called deserializeArrayOrEmpty however returns a list?
can we make it returning array in order to encapsulate
.mapToInt(Integer::intValue)
.toArray();and probably just call it deserializeArray
Contributor
Author
There was a problem hiding this comment.
Renamed to deserializeListOrEmpty and used it for objects like SortOrder. Introduced a new method called deserializeToIntArray that uses deserializeListOrEmpty.
snuyanzin
approved these changes
Jun 1, 2026
Contributor
snuyanzin
left a comment
There was a problem hiding this comment.
LGTM
Thanks for addressing feedback
let's wait for CI
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
TABLE_ARG_CALLnodes always wrotepartitionKeys,orderKeys, andorderDirectionsinto the compiled plan JSON, even when empty. Table arguments withoutPARTITION BYandORDER BYare common, so these empty arrays bloat the plan for no benefit. This change omits the arrays when empty, matching howserializeCallalready skips empty operands.Brief change log
RexNodeJsonSerializerskipspartitionKeys/orderKeys/orderDirectionswhen they are empty.RexNodeJsonDeserializertreats the three fields as optional and defaults them to empty arrays when absent, so plans written by older versions still load.TO_CHANGELOG/FROM_CHANGELOGrestore plan files to drop the now-omitted arrays.Verifying this change
This change is already covered by existing tests, such as the
stream-exec-process-table-function,TO_CHANGELOG, andFROM_CHANGELOGrestore tests. They load the regenerated plans through the deserializer and pass. The deserializer change keeps older plans that still contain the empty arrays loadable, preserving backward compatibility.Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?