danny0405 commented on code in PR #9327:
URL: https://github.com/apache/hudi/pull/9327#discussion_r1282541082
##########
hudi-common/src/test/java/org/apache/hudi/common/model/TestHoodieRecordDelegate.java:
##########
@@ -70,4 +78,24 @@ public void testKryoSerializeDeserialize() {
assertEquals(new HoodieRecordLocation("001", "file01"),
hoodieRecordDelegate.getCurrentLocation().get());
assertEquals(new HoodieRecordLocation("001", "file-01"),
hoodieRecordDelegate.getNewLocation().get());
}
+
+ public Kryo getKryoInstance() {
+ final Kryo kryo = new Kryo();
+ // This instance of Kryo should not require prior registration of classes
+ kryo.setRegistrationRequired(false);
+ kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new
StdInstantiatorStrategy()));
+ // Handle cases where we may have an odd classloader setup like with
libjars
+ // for hadoop
+ kryo.setClassLoader(Thread.currentThread().getContextClassLoader());
+
+ // Register Hudi's classes
+ new HoodieCommonKryoRegistrar().registerClasses(kryo);
+
+ // Register serializers
+ kryo.register(Utf8.class, new SerializationUtils.AvroUtf8Serializer());
+ kryo.register(GenericData.Fixed.class, new GenericAvroSerializer<>());
Review Comment:
Do we need a registration for avro classes?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]