Skip to content

Commit

Permalink
Apply PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
clairemcginty committed Aug 16, 2023
1 parent c631e1c commit c26d0fb
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,7 @@ trait AvroCoders {
override def apply(writer: Schema, reader: Schema): DatumReader[T] = {
// create the datum writer using the schema api
// class API might be unsafe. See schemaForClass
val schema = schemaForClass(clazz).get
val datumReader = new ReflectDatumReader[T](schema, schema, new ReflectData())
datumReader.setExpected(reader)
datumReader.setSchema(writer)
val datumReader = new ReflectDatumReader[T](writer, reader, new ReflectData())
// for backward compat, add logical type support by default
AvroUtils.addLogicalTypeConversions(datumReader.getData)
datumReader
Expand All @@ -165,8 +162,7 @@ trait AvroCoders {
override def apply(writer: Schema): DatumWriter[T] = {
// create the datum writer using the schema api
// class API might be unsafe. See schemaForClass
val datumWriter = new ReflectDatumWriter[T](schemaForClass(clazz).get, new ReflectData())
datumWriter.setSchema(writer)
val datumWriter = new ReflectDatumWriter[T](writer, new ReflectData())
// for backward compat, add logical type support by default
AvroUtils.addLogicalTypeConversions(datumWriter.getData)
datumWriter
Expand Down

0 comments on commit c26d0fb

Please sign in to comment.