Skip to content

[FLINK-38205][format][pb] Discard unknown fields by default #26881

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

X-czh
Copy link
Contributor

@X-czh X-czh commented Aug 8, 2025

What is the purpose of the change

Currently, Flink Protobuf format does not discard unknown fields (and it does not even provide an option for that!). When the user PB IDL is a subset of the whole IDL, quite a few CPU is wasted for no means as Flink SQL will automatically discard all unknown fields anyway when converting to RowData. We should make it discard unknown fields by default.

Brief change log

Use PB's DiscardUnknownFieldsWrapper to wrap the parser.

Verifying this change

This change is already covered by existing PB format tests.

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

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

Documentation

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

@flinkbot
Copy link
Collaborator

flinkbot commented Aug 8, 2025

CI report:

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

Copy link
Contributor

@davidradl davidradl left a comment

Choose a reason for hiding this comment

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

Please could you add tests for this code change.

Also I notice that many existing tests for protobuf refer to unknown fields - are these still valid tests after this proposed change?

@github-actions github-actions bot added the community-reviewed PR has been reviewed by the community. label Aug 13, 2025
@X-czh
Copy link
Contributor Author

X-czh commented Aug 14, 2025

@davidradl Those existing tests for protobuf with unknown fields are still valid, and actually act as good testcases for this PR already.

@X-czh
Copy link
Contributor Author

X-czh commented Aug 14, 2025

I'll add a separate testcase for unknown fields.

@github-actions github-actions bot added community-reviewed PR has been reviewed by the community. and removed community-reviewed PR has been reviewed by the community. labels Aug 15, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
community-reviewed PR has been reviewed by the community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants