Github user rmetzger commented on a diff in the pull request:
https://github.com/apache/flink/pull/413#discussion_r25130737
--- Diff:
flink-java/src/main/java/org/apache/flink/api/java/typeutils/runtime/AvroSerializer.java
---
@@ -154,6 +176,7 @@ private void checkAvroInitialized() {
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
+ this.kryo.register(GenericData.Array.class, new
KryoSerializer.SpecificInstanceCollectionSerializer(ArrayList.class));
--- End diff --
Without that, Kryo's `CollectionSerializer` is not able to properly
re-instantiate the `GenericData.Array`.
It fails with the following error:
```
Class cannot be created (missing no-arg constructor):
org.apache.avro.generic.GenericData$Array
Serialization trace:
type_array_boolean (org.apache.flink.api.io.avro.generated.User)
com.esotericsoftware.kryo.KryoException: Class cannot be created (missing
no-arg constructor): org.apache.avro.generic.GenericData$Array
Serialization trace:
type_array_boolean (org.apache.flink.api.io.avro.generated.User)
at
com.esotericsoftware.kryo.Kryo$DefaultInstantiatorStrategy.newInstantiatorOf(Kryo.java:1228)
at com.esotericsoftware.kryo.Kryo.newInstantiator(Kryo.java:1049)
at com.esotericsoftware.kryo.Kryo.newInstance(Kryo.java:1058)
at
com.esotericsoftware.kryo.serializers.CollectionSerializer.createCopy(CollectionSerializer.java:124)
at
com.esotericsoftware.kryo.serializers.CollectionSerializer.copy(CollectionSerializer.java:128)
at
com.esotericsoftware.kryo.serializers.CollectionSerializer.copy(CollectionSerializer.java:22)
at com.esotericsoftware.kryo.Kryo.copy(Kryo.java:862)
at
com.esotericsoftware.kryo.serializers.AsmCacheFields$AsmObjectField.copy(AsmCacheFields.java:177)
at
com.esotericsoftware.kryo.serializers.FieldSerializer.copy(FieldSerializer.java:634)
at com.esotericsoftware.kryo.Kryo.copy(Kryo.java:862)
at
org.apache.flink.api.java.typeutils.runtime.AvroSerializer.copy(AvroSerializer.java:102)
at
org.apache.flink.api.common.operators.GenericDataSourceBase.executeOnCollections(GenericDataSourceBase.java:196)
at
org.apache.flink.api.common.operators.CollectionExecutor.executeDataSource(CollectionExecutor.java:170)
at
org.apache.flink.api.common.operators.CollectionExecutor.execute(CollectionExecutor.java:132)
at
org.apache.flink.api.common.operators.CollectionExecutor.executeUnaryOperator(CollectionExecutor.java:180)
at
org.apache.flink.api.common.operators.CollectionExecutor.execute(CollectionExecutor.java:126)
at
org.apache.flink.api.common.operators.CollectionExecutor.executeUnaryOperator(CollectionExecutor.java:180)
at
org.apache.flink.api.common.operators.CollectionExecutor.execute(CollectionExecutor.java:126)
at
org.apache.flink.api.common.operators.CollectionExecutor.execute(CollectionExecutor.java:108)
at
org.apache.flink.api.common.operators.CollectionExecutor.executeDataSink(CollectionExecutor.java:159)
at
org.apache.flink.api.common.operators.CollectionExecutor.execute(CollectionExecutor.java:135)
at
org.apache.flink.api.common.operators.CollectionExecutor.execute(CollectionExecutor.java:108)
at
org.apache.flink.api.common.operators.CollectionExecutor.execute(CollectionExecutor.java:99)
at
org.apache.flink.api.java.CollectionEnvironment.execute(CollectionEnvironment.java:34)
at
org.apache.flink.test.util.JavaProgramTestBase$CollectionTestEnvironment.execute(JavaProgramTestBase.java:269)
at
org.apache.flink.api.io.avro.AvroPojoTest.runProgram(AvroPojoTest.java:195)
at
org.apache.flink.api.io.avro.AvroPojoTest.testProgram(AvroPojoTest.java:115)
at
org.apache.flink.test.util.JavaProgramTestBase.testJobCollectionExecution(JavaProgramTestBase.java:172)
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---