[ https://issues.apache.org/jira/browse/FLINK-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14332107#comment-14332107 ]
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_r25130794 --- Diff: flink-java/src/main/java/org/apache/flink/api/java/typeutils/runtime/AvroSerializer.java --- @@ -91,7 +98,22 @@ public T createInstance() { @Override public T copy(T from) { checkKryoInitialized(); - return this.kryo.copy(from); + try { + return this.kryo.copy(from); + } catch(KryoException ke) { + // kryo was unable to copy it, so we do it through serialization: + ByteArrayOutputStream baout = new ByteArrayOutputStream(); + Output output = new Output(baout); + + kryo.writeObject(output, from); + + output.close(); + + ByteArrayInputStream bain = new ByteArrayInputStream(baout.toByteArray()); + Input input = new Input(bain); + + return (T)kryo.readObject(input, from.getClass()); --- End diff -- Some Kryo serializers do not implement the copy method. In that case, we do a serialization copy. > 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)