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

Use avro builder API #5119

Merged
merged 3 commits into from
Dec 14, 2023
Merged

Use avro builder API #5119

merged 3 commits into from
Dec 14, 2023

Conversation

RustedBones
Copy link
Contributor

No description provided.

Comment on lines +155 to +157
.sink(AvroBytesUtil.schema)
.asInstanceOf[BAvroIO.Sink[T]]
.withDatumWriterFactory(AvroBytesUtil.datumWriterFactory)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Small rewrite here to move away from deprecated sinkViaGenericRecords API

private val byteField = schema.getField("bytes")

def datumWriterFactory[T: Coder]: DatumWriterFactory[T] = {
val bCoder = CoderMaterializer.beamWithDefault(Coder[T])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Logic change here since we do not use the coder options for byte serialization. I think this cased of an issue when consuming data from PubSub, and tunring one Nullable, records could not be read.

Copy link
Contributor

@clairemcginty clairemcginty left a comment

Choose a reason for hiding this comment

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

🙌

@RustedBones RustedBones changed the title Use avro schema builder API Use avro builder API Dec 14, 2023
Copy link

codecov bot commented Dec 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (45c1bd3) 63.36% compared to head (1b12a9d) 63.34%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5119      +/-   ##
==========================================
- Coverage   63.36%   63.34%   -0.02%     
==========================================
  Files         291      291              
  Lines       10842    10837       -5     
  Branches      745      753       +8     
==========================================
- Hits         6870     6865       -5     
  Misses       3972     3972              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RustedBones RustedBones merged commit acfb416 into main Dec 14, 2023
11 checks passed
@RustedBones RustedBones deleted the avro-schema-builder branch December 14, 2023 15:45
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.

2 participants