shardulm94 commented on a change in pull request #31597:
URL: https://github.com/apache/spark/pull/31597#discussion_r586003264
##########
File path: core/src/main/scala/org/apache/spark/serializer/KryoSerializer.scala
##########
@@ -153,8 +153,13 @@ class KryoSerializer(conf: SparkConf)
kryo.register(classOf[SerializableJobConf], new KryoJavaSerializer())
kryo.register(classOf[PythonBroadcast], new KryoJavaSerializer())
- kryo.register(classOf[GenericRecord], new
GenericAvroSerializer(avroSchemas))
- kryo.register(classOf[GenericData.Record], new
GenericAvroSerializer(avroSchemas))
+ def registerAvro[T >: Null <: GenericContainer](implicit ct: ClassTag[T]) =
+ kryo.register(ct.runtimeClass, new GenericAvroSerializer[T](avroSchemas))
+ registerAvro[GenericRecord]
+ registerAvro[GenericData.Record]
+ registerAvro[GenericData.Array[_]]
+ registerAvro[GenericData.EnumSymbol]
+ registerAvro[GenericData.Fixed]
Review comment:
I think for specific records we will need to use a different codepath
inside Avro for serde viz. `SpecificDatum(Reader|Writer)` instead of
`GenericDatum(Reader|Writer)` which is currently how `GenericAvroSerializer` is
implemented. Also I think we will need to register each concrete SpecificRecord
class for Kryo to work correctly. Thoughts?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]