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

Sink<GenericObject> unwrap internal AutoConsumeSchema and allow to handle topics with KeyValue schema #10211

Merged
merged 43 commits into from
Apr 17, 2021

Conversation

eolivelli
Copy link
Contributor

@eolivelli eolivelli commented Apr 13, 2021

Motivation

When you run a Sink (or Sink) you are using AutoConsumeSchema and AutoConsumeSchema is a wrapper around the actual schema attached to the topic.

In case of a topic with KeyValueSchema you are not able to access the Key Schema and the Value Schema because Record#getSchema returns the AutoConsumeSchema and not the KeyValueSchema itself.

Modifications

  • In SinkRecord#getSchema we unwrap the AutoConsumeSchema schema and allow to access the actual schema set on the topic.
  • Add new integration test
  • Add handling of TopicMessageImpl in PulsarSource (as we are doing with MessageImpl)

The test sets a property on the message with the expected schema type, this way the sink breaks in case of some error in the system and bad detection of the schema.

Verifying this change

This change added tests

Documentation

I am going to write documentation about how to write Pulsar IO Sinks that work with any schema without binding to a specific schema at compile time (Sink)

@eolivelli
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

@sijie sijie added this to the 2.8.0 milestone Apr 13, 2021
@eolivelli
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

@eolivelli
Copy link
Contributor Author

I am adding debug in order to see what's wrong in CI.
I will revert all of the debug code when I see CI green

@eolivelli
Copy link
Contributor Author

@codelipenghui I finally figured out what was wrong in the integration test. now it passes locally.
Can you please take a final look ?

@eolivelli eolivelli merged commit 0f07dda into apache:master Apr 17, 2021
@eolivelli eolivelli deleted the impl/sink-keyvalue branch April 17, 2021 08:14
eolivelli added a commit to datastax/pulsar that referenced this pull request May 12, 2021
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