You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by li...@apache.org on 2017/04/08 04:14:54 UTC
spark git commit: [SPARK-20262][SQL] AssertNotNull should throw
NullPointerException
Repository: spark
Updated Branches:
refs/heads/master 7577e9c35 -> e1afc4dcc
[SPARK-20262][SQL] AssertNotNull should throw NullPointerException
## What changes were proposed in this pull request?
AssertNotNull currently throws RuntimeException. It should throw NullPointerException, which is more specific.
## How was this patch tested?
N/A
Author: Reynold Xin <rx...@databricks.com>
Closes #17573 from rxin/SPARK-20262.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e1afc4dc
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e1afc4dc
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e1afc4dc
Branch: refs/heads/master
Commit: e1afc4dcca8ba517f48200c0ecde1152505e41ec
Parents: 7577e9c
Author: Reynold Xin <rx...@databricks.com>
Authored: Fri Apr 7 21:14:50 2017 -0700
Committer: Xiao Li <ga...@gmail.com>
Committed: Fri Apr 7 21:14:50 2017 -0700
----------------------------------------------------------------------
.../spark/sql/catalyst/expressions/objects/objects.scala | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/e1afc4dc/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
index 00e2ac9..53842ef 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
@@ -989,7 +989,7 @@ case class InitializeJavaBean(beanInstance: Expression, setters: Map[String, Exp
* `Int` field named `i`. Expression `s.i` is nullable because `s` can be null. However, for all
* non-null `s`, `s.i` can't be null.
*/
-case class AssertNotNull(child: Expression, walkedTypePath: Seq[String])
+case class AssertNotNull(child: Expression, walkedTypePath: Seq[String] = Nil)
extends UnaryExpression with NonSQLExpression {
override def dataType: DataType = child.dataType
@@ -1005,7 +1005,7 @@ case class AssertNotNull(child: Expression, walkedTypePath: Seq[String])
override def eval(input: InternalRow): Any = {
val result = child.eval(input)
if (result == null) {
- throw new RuntimeException(errMsg)
+ throw new NullPointerException(errMsg)
}
result
}
@@ -1021,7 +1021,7 @@ case class AssertNotNull(child: Expression, walkedTypePath: Seq[String])
${childGen.code}
if (${childGen.isNull}) {
- throw new RuntimeException($errMsgField);
+ throw new NullPointerException($errMsgField);
}
"""
ev.copy(code = code, isNull = "false", value = childGen.value)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org