[
https://issues.apache.org/jira/browse/FLINK-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14332101#comment-14332101
]
ASF GitHub Bot commented on FLINK-1567:
---------------------------------------
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)
```
> Add option to switch between Avro and Kryo serialization for GenericTypes
> -------------------------------------------------------------------------
>
> Key: FLINK-1567
> URL: https://issues.apache.org/jira/browse/FLINK-1567
> Project: Flink
> Issue Type: Improvement
> Affects Versions: 0.8.0, 0.9
> Reporter: Robert Metzger
> Assignee: Robert Metzger
>
> Allow users to switch the underlying serializer for GenericTypes.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)