[
https://issues.apache.org/jira/browse/FLINK-3088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15029941#comment-15029941
]
ASF GitHub Bot commented on FLINK-3088:
---------------------------------------
Github user rmetzger commented on a diff in the pull request:
https://github.com/apache/flink/pull/1415#discussion_r46052833
--- Diff:
flink-java/src/main/java/org/apache/flink/api/java/typeutils/runtime/AvroSerializer.java
---
@@ -96,27 +93,38 @@ public T createInstance() {
@Override
public T copy(T from) {
checkKryoInitialized();
- return this.kryo.copy(from);
+
+ try {
+ return kryo.copy(from);
+ } catch (KryoException ke) {
+ // Kryo could not copy the object --> try to
serialize/deserialize the object
+ try {
+ byte[] byteArray =
InstantiationUtil.serializeToByteArray(this, from);
+
+ return
InstantiationUtil.deserializeFromByteArray(this, byteArray);
+ } catch (IOException ioe) {
+ throw new RuntimeException("Could not copy
object by serializing/deserializing" +
--- End diff --
missing space
> WritableSerializer cannot copy writable object
> ----------------------------------------------
>
> Key: FLINK-3088
> URL: https://issues.apache.org/jira/browse/FLINK-3088
> Project: Flink
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.0.0, 0.10.1
> Reporter: Till Rohrmann
> Assignee: Till Rohrmann
>
> The {{WritableSerializer}}, {{ValueSerializer}}, {{AvroSerializer}},
> {{WritableComparator}} and {{ValueComparator}} use plain {{Kryo}} instances
> to copy the objects. In cases where {{Kryo}} fails to copy the object, e.g.
> missing no-arg constructor, the serializer and comparator instances fail even
> though the objects are serializable.
> As a fallback strategy I propose to copy the objects by serializing and
> deserializing them.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)