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
[BEAM-7808] Add method to convert avro field to beam field #9142
Conversation
R: @lukecwik R: @reuvenlax R: @akedin Can you have a look in to this. |
0bda003
to
172b563
Compare
cc: @reuvenlax cc: @akedin We have a requirement were we have to add an avro field to the beam row. So this helper function will be helpful to convert the avro field to beam field and then add it to the beam row. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Not sure I understand the use case though. You have some Beam rows with a schema. And you also have an Avro schema that you want to merge (partially) with that existing Beam schema? Would it make sense to eventually build a more generic projection framework? Something that would allow you to merge the two schemas and then pick only the fields you need. And if this happens as part of some kind of Join implementation then it probably should be supported there as well in a more generic fashion.
Below is the scenario we are trying: We read incoming data stream from Kafka and then apply a Beam Transform. After tranformation again the data is written to Kafka Sink. So we needed this function which can convert the avro Field to Beam Field and finally merge it with incoming row. |
@akedin @TheNeuralBit If changes are fine, can this be merged. |
Apologies for the delay. LGTM and thanks for the contribution! I think this is great to include if it unblocks you, but like Anton I'm curious if we can find a way to support this pattern more generally. If I'm understanding correctly it sounds like maybe the Join transform should do what you want? If not maybe there's a feature request in there. |
Currently we have static methods in AvroUtils class, which exposes methods like
toBeamSchema(), toBeamRowStrict(). These methods work only on generic record.
Method is now added which supports converting avroField to BeamField and vice vesra
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.Post-Commit Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.