Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/2529#discussion_r18311198
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SpecificRow.scala
---
@@ -306,4 +306,8 @@ final class SpecificMutableRow(val values:
Array[MutableValue]) extends MutableR
override def getByte(i: Int): Byte = {
values(i).asInstanceOf[MutableByte].value
}
+
+ override def getAs[T](i: Int): T = {
+ values(i).asInstanceOf[MutableAny].value.asInstanceOf[T]
--- End diff --
You don't want the first `.asInstanceOf`here as it can cause errors.
```scala
scala> new SpecificMutableRow(IntegerType :: Nil).getAs[Int](0)
java.lang.ClassCastException:
org.apache.spark.sql.catalyst.expressions.MutableInt cannot be cast to
org.apache.spark.sql.catalyst.expressions.MutableAny
```
Since all `MutableValue` classes have a `.value` method I think you can
just leave it out.
---
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]