flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [6/7] flink git commit: [FLINK-3617] [scala apis] Added null value check.
Date Mon, 16 Jan 2017 20:17:48 GMT
[FLINK-3617] [scala apis] Added null value check.


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

Branch: refs/heads/release-1.2
Commit: 27c11e1b79bd68cbd2e8275c7938478e2e9532e6
Parents: d1b86aa
Author: Aleksandr Chermenin <aleksandr_chermenin@epam.com>
Authored: Fri Dec 16 14:42:50 2016 +0300
Committer: Stephan Ewen <sewen@apache.org>
Committed: Mon Jan 16 15:38:15 2017 +0100

----------------------------------------------------------------------
 .../flink/api/scala/typeutils/CaseClassSerializer.scala  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/27c11e1b/flink-scala/src/main/scala/org/apache/flink/api/scala/typeutils/CaseClassSerializer.scala
----------------------------------------------------------------------
diff --git a/flink-scala/src/main/scala/org/apache/flink/api/scala/typeutils/CaseClassSerializer.scala
b/flink-scala/src/main/scala/org/apache/flink/api/scala/typeutils/CaseClassSerializer.scala
index 625ee80..29b4952 100644
--- a/flink-scala/src/main/scala/org/apache/flink/api/scala/typeutils/CaseClassSerializer.scala
+++ b/flink-scala/src/main/scala/org/apache/flink/api/scala/typeutils/CaseClassSerializer.scala
@@ -20,7 +20,8 @@ package org.apache.flink.api.scala.typeutils
 import org.apache.flink.annotation.Internal
 import org.apache.flink.api.common.typeutils.TypeSerializer
 import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase
-import org.apache.flink.core.memory.{DataOutputView, DataInputView}
+import org.apache.flink.core.memory.{DataInputView, DataOutputView}
+import org.apache.flink.types.NullFieldException
 
 /**
  * Serializer for Case Classes. Creation and access is different from
@@ -97,7 +98,13 @@ abstract class CaseClassSerializer[T <: Product](
     var i = 0
     while (i < arity) {
       val serializer = fieldSerializers(i).asInstanceOf[TypeSerializer[Any]]
-      serializer.serialize(value.productElement(i), target)
+      val o = value.productElement(i)
+      try
+        serializer.serialize(o, target)
+      catch {
+        case e: NullPointerException =>
+          throw new NullFieldException(i, e)
+      }
       i += 1
     }
   }


Mime
View raw message