flink icon indicating copy to clipboard operation
flink copied to clipboard

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

Open X-czh opened this issue 4 months ago • 3 comments

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)

X-czh avatar Aug 08 '25 00:08 X-czh

CI report:

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

flinkbot avatar Aug 08 '25 00:08 flinkbot

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

X-czh avatar Aug 14 '25 01:08 X-czh

I'll add a separate testcase for unknown fields.

X-czh avatar Aug 14 '25 01:08 X-czh