Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[FLINK-32418][formats-protobuf] Fix ClassNotFoundException when using protobuf in SQL-Client #23032

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

m-kay
Copy link

@m-kay m-kay commented Jul 20, 2023

Purpose of the change

This pull request changes protobuf format to always use the classloader which is passed on creation for the DynamicTableFactory.Context instead of using the thread local classloader as proposed in FLINK-32418. This is needed to load generated protobuf classes when using the protobuf format in SQL-Client.

Change log

  • The classloader passed in DynamicTableFactory.Context is stored in a PbFormatContextwhich is then passed further down the components
  • PbFormatUtils.getDescriptor has an additional parameter where the classloader from the PbFormatContaxt has to be passed to resolve generated Protobuf classes correctly.

Verifying this change

This change is already covered by existing tests, such as SimpleProtoToRowTest.

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: yes
  • 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

@flinkbot
Copy link
Collaborator

flinkbot commented Jul 20, 2023

CI report:

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

Copy link
Member

@libenchao libenchao left a comment

Choose a reason for hiding this comment

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

@m-kay Thanks for your contribution, and sorry for the delay, the PR looks good generally, I'm just wondering if it's possible to have a test case which shows the problem and passes after this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants