提交 fdce1f31 编写于 作者: A Aleksandr Chermenin 提交者: Stephan Ewen

[FLINK-3617] [scala apis] Added null value check.

上级 c4626cba
......@@ -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
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册