flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trohrm...@apache.org
Subject flink git commit: [hotfix] OptionSerializer.duplicate to respect stateful element serializer
Date Tue, 26 Apr 2016 15:42:53 GMT
Repository: flink
Updated Branches:
  refs/heads/master e293e68c9 -> 1ccc79891


[hotfix] OptionSerializer.duplicate to respect stateful element serializer


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/1ccc7989
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/1ccc7989
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/1ccc7989

Branch: refs/heads/master
Commit: 1ccc798914a2bd94157f2a86f7961bc1cc5de490
Parents: e293e68
Author: Till Rohrmann <trohrmann@apache.org>
Authored: Tue Apr 26 17:39:47 2016 +0200
Committer: Till Rohrmann <trohrmann@apache.org>
Committed: Tue Apr 26 17:42:42 2016 +0200

----------------------------------------------------------------------
 .../flink/api/scala/typeutils/OptionSerializer.scala      | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/1ccc7989/flink-scala/src/main/scala/org/apache/flink/api/scala/typeutils/OptionSerializer.scala
----------------------------------------------------------------------
diff --git a/flink-scala/src/main/scala/org/apache/flink/api/scala/typeutils/OptionSerializer.scala
b/flink-scala/src/main/scala/org/apache/flink/api/scala/typeutils/OptionSerializer.scala
index 07fba86..a8b3a56 100644
--- a/flink-scala/src/main/scala/org/apache/flink/api/scala/typeutils/OptionSerializer.scala
+++ b/flink-scala/src/main/scala/org/apache/flink/api/scala/typeutils/OptionSerializer.scala
@@ -28,7 +28,15 @@ import org.apache.flink.core.memory.{DataOutputView, DataInputView}
 class OptionSerializer[A](val elemSerializer: TypeSerializer[A])
   extends TypeSerializer[Option[A]] {
 
-  override def duplicate: OptionSerializer[A] = this
+  override def duplicate: OptionSerializer[A] = {
+    val duplicatedElemSerializer = elemSerializer.duplicate()
+
+    if (duplicatedElemSerializer.eq(elemSerializer)) {
+      this
+    } else {
+      new OptionSerializer[A](duplicatedElemSerializer)
+    }
+  }
 
   override def createInstance: Option[A] = {
     None


Mime
View raw message