[BEAM-7829] Add schema names when converting with AvroUtils.toAvroSchema #9247
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There's a subtle problem with unnamed records in Avro and Java -- they can be used to correctly serialize/deserialize binary data as long as nobody counts on serializing/deserializing the actual Avro schema as a JSON string.
This can work if both reader and writer can infer the schema from another source (like the Beam Schema), but is certain to break when passing the schema or record to a transform that expects the schema to meet the Avro specification.
More discussion at: https://issues.apache.org/jira/browse/AVRO-2492
This change ensures that no anonymous Avro records will be created as part of translating a Beam schema.
N.B. Credit goes to @iemejia for this implementation, I just cleaned up the tests.
N.B.2 I get some minor credit :D There were some bugs with potential namespace collisions. The internal implementation here should be very close to what Spark does with auto-generated Avro schemas.
R: @reuvenlax @kanterov
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.