Skip to content

Pulsar IO: Make Source topic Schema information available to downstream Sinks - #8854

Merged
codelipenghui merged 6 commits into
apache:masterfrom
eolivelli:fix/sink-see-schema
Dec 11, 2020
Merged

codelipenghui merged 6 commits into
apache:masterfrom
eolivelli:fix/sink-see-schema

Conversation

@eolivelli

@eolivelli eolivelli commented Dec 7, 2020 •

Copy link
Copy Markdown
Contributor

Changes:

  • extract original Schema from the message read from the topic
  • expose the schema into the PulsarRecord implementation
  • add unit test
  • in PulsarSink detect the fact that the source record is directly from a PulsarSource and drop the schema (there was already a check about the fact that the source record is a PulsarRecord, so this patch is not adding a new shortcircuit)
  • little refactor in PulsarSink in order to make it clear that we are working with SinkRecord (casts were already present in the code, and it would not have worked without SinkRecord, so we are only tidying it up)

Motivation

Pulsar sinks cannot access the original Schema of the Message they are consuming,
this is because currently PulsarSource does not publish the Schema information to downstream processing.

Modifications

Try to retrieve Schema information from the Message and push it down to the Record.

Verifying this change

  • Make sure that the change passes the CI checks.
  • This change added tests and can be verified as follows:
  • added unit test
  • tested manually with Pulsar Standalone
  • there are existing unit and integration tests that are touching this change (in fact I had to iterate a few times)

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

with this change Pulsar function users and especially Pulsar I/O Sinks will be able to inspect the original schema in case the processing starts from a Pulsar topic (PulsarSource)

@eolivelli

Copy link
Copy Markdown
Contributor Author

@315157973 @nlu90 @jerrypeng
could you please take a look ?

This can be considered a small breaking behavior change, but I would like to see it cherry picked to 2.7.x branch if possible
cc @sijie @rdhabalia

@rdhabalia rdhabalia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@eolivelli

Copy link
Copy Markdown
Contributor Author

If it is possible to see this also on 2.6.3 it would be greater

@sijie sijie added this to the 2.8.0 milestone Dec 8, 2020
@sijie sijie added area/connector type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages release/2.6.3 release/2.7.1 labels Dec 8, 2020
@sijie

sijie commented Dec 8, 2020

Copy link
Copy Markdown
Member

@codelipenghui let's cherry-pick this change to 2.6.3 release.

@sijie

sijie commented Dec 8, 2020

Copy link
Copy Markdown
Member

/pulsarbot run-failure-checks

@codelipenghui

Copy link
Copy Markdown
Contributor

/pulsarbot run-failure-checks

1 similar comment
@eolivelli

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@eolivelli

Copy link
Copy Markdown
Contributor Author

There is a test failure related to schemas and Pulsar functions.
I am investigating it now

@eolivelli

Copy link
Copy Markdown
Contributor Author

The problem in the test is that PulsarSink is using the record schema to write to the destination topic, but this is wrong because it must use the schema of the destination topic.

@eolivelli

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@eolivelli

Copy link
Copy Markdown
Contributor Author

many jobs failed with
/__w/_temp/4f45ee2d-1924-45c7-b32d-fd82169e5f0c.sh: 1: /__w/_temp/4f45ee2d-1924-45c7-b32d-fd82169e5f0c.sh: ./build/run_unit_group.sh: not found

@eolivelli

Copy link
Copy Markdown
Contributor Author

@lhotari @codelipenghui @sijie CI errors seems not related to my patch,
is there something I can do ?

@eolivelli
eolivelli force-pushed the fix/sink-see-schema branch from 23a6089 to 0ab552c Compare December 9, 2020 12:05
@eolivelli

Copy link
Copy Markdown
Contributor Author

I have rebased onto current master
the commit that changed the CI behavior is
a8a7993

@eolivelli

Copy link
Copy Markdown
Contributor Author

btw I thought that the PR validation is run against the PR branch merged with the target branch, so rebasing onto latest master should not have much effect

@eolivelli

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@eolivelli

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@eolivelli eolivelli changed the title PulsarSource does not report original Schema information Pulsar IO: Make Source topic Schema information available to downstream Sinks Dec 10, 2020
@eolivelli

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

- extract original Schema from the message read from the topic
- expose the schema to the PulsarRecord implement
@eolivelli

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@codelipenghui
codelipenghui merged commit 0e6ad1c into apache:master Dec 11, 2020
@eolivelli
eolivelli deleted the fix/sink-see-schema branch December 11, 2020 06:03
codelipenghui pushed a commit that referenced this pull request Dec 21, 2020
…am Sinks (#8854)

## Changes:
- extract original Schema from the message read from the topic
- expose the schema into the PulsarRecord implementation
- add unit test
- in PulsarSink detect the fact that the source record is directly from a PulsarSource and drop the schema (there was already a check about the fact that the source record is a PulsarRecord, so this patch is not adding a new shortcircuit)
- little refactor in PulsarSink in order to make it clear that we are working with SinkRecord (casts were already present in the code, and it would not have worked without SinkRecord, so we are only tidying it up)

### Motivation
Pulsar sinks cannot access the original Schema of the Message they are consuming,
this is because currently PulsarSource does not publish the Schema information to downstream processing.

### Modifications
Try to retrieve Schema information from the Message and push it down to the Record.

### Verifying this change
- [X] Make sure that the change passes the CI checks.
- [X] This change added tests and can be verified as follows:
- added unit test
- tested manually with Pulsar Standalone 
- there are existing unit and integration tests that are touching this change (in fact I had to iterate a few times)

### Does this pull request potentially affect one of the following parts: yes
with this change Pulsar function users and especially Pulsar I/O Sinks will be able to inspect the original schema in case the processing starts from a Pulsar topic (PulsarSource)


(cherry picked from commit 0e6ad1c)
codelipenghui pushed a commit that referenced this pull request Dec 21, 2020
…am Sinks (#8854)

## Changes:
- extract original Schema from the message read from the topic
- expose the schema into the PulsarRecord implementation
- add unit test
- in PulsarSink detect the fact that the source record is directly from a PulsarSource and drop the schema (there was already a check about the fact that the source record is a PulsarRecord, so this patch is not adding a new shortcircuit)
- little refactor in PulsarSink in order to make it clear that we are working with SinkRecord (casts were already present in the code, and it would not have worked without SinkRecord, so we are only tidying it up)

### Motivation
Pulsar sinks cannot access the original Schema of the Message they are consuming,
this is because currently PulsarSource does not publish the Schema information to downstream processing.

### Modifications
Try to retrieve Schema information from the Message and push it down to the Record.

### Verifying this change
- [X] Make sure that the change passes the CI checks.
- [X] This change added tests and can be verified as follows:
- added unit test
- tested manually with Pulsar Standalone 
- there are existing unit and integration tests that are touching this change (in fact I had to iterate a few times)

### Does this pull request potentially affect one of the following parts: yes
with this change Pulsar function users and especially Pulsar I/O Sinks will be able to inspect the original schema in case the processing starts from a Pulsar topic (PulsarSource)


(cherry picked from commit 0e6ad1c)
@codelipenghui codelipenghui added the cherry-picked/branch-2.7 Archived: 2.7 is end of life label Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/connector cherry-picked/branch-2.7 Archived: 2.7 is end of life release/2.6.3 release/2.7.1 type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants