Skip to content

Commit 98e1463

Browse files
committed
address comments
1 parent 8870650 commit 98e1463

File tree

1 file changed

+9
-2
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions

1 file changed

+9
-2
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ case class AssertNotNull(child: Expression, walkedTypePath: Seq[String])
691691

692692
/**
693693
* Returns the value of field at index `index` from the external row `child`.
694+
* This class can be viewed as [[GetStructField]] for [[Row]]s instead of [[InternalRow]]s.
694695
*
695696
* Note that the input row and the field we try to get are both guaranteed to be not null, if they
696697
* are null, a runtime exception will be thrown.
@@ -715,9 +716,15 @@ case class GetExternalRowField(
715716

716717
val code = s"""
717718
${row.code}
718-
if (${row.isNull} || ${row.value}.isNullAt($index)) {
719-
throw new RuntimeException("Runtime null check failed.");
719+
720+
if (${row.isNull}) {
721+
throw new RuntimeException("The input external row cannot be null.");
722+
}
723+
724+
if (${row.value}.isNullAt($index)) {
725+
throw new RuntimeException("The ${index}th field of input row cannot be null.");
720726
}
727+
721728
final ${ctx.javaType(dataType)} ${ev.value} = $getField;
722729
"""
723730
ev.copy(code = code, isNull = "false")

0 commit comments

Comments
 (0)