Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/2529#discussion_r18107395
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Row.scala
---
@@ -181,6 +184,11 @@ class GenericRow(protected[sql] val values:
Array[Any]) extends Row {
values(i).asInstanceOf[String]
}
+ override def getAs[T](i: Int): T = {
+ if (values(i) == null) sys.error("Failed to check null bit for generic
value.")
--- End diff --
Its kinda weird to throw this error for non-primitive types as you can
actually return null here. The check is only to avoid getting back data that
looks valid but is not. For example:
```scala
scala> def getAs[T] = null.asInstanceOf[T]
getAs: [T]=> T
scala> getAs[Int]
res0: Int = 0
scala> getAs[String]
res1: String = null
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]