gemelen commented on a change in pull request #29995:
URL: https://github.com/apache/spark/pull/29995#discussion_r502934176
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/UnsafeArraySuite.scala
##########
@@ -72,9 +72,9 @@ class UnsafeArraySuite extends SparkFunSuite {
arrayData
}
- private def toUnsafeArray[T : TypeTag](array: Array[T]): ArrayData = {
+ private def toUnsafeArray[T: Manifest](array: Array[T]): ArrayData = {
val converted =
ExpressionEncoder[Array[T]].createSerializer().apply(array).getArray(0)
- assert(converted.isInstanceOf[T])
+ assert(manifest[T].runtimeClass.isInstance(converted))
Review comment:
```
val converted =
ExpressionEncoder[Array[T]].createSerializer().apply(array).getArray(0)
```
is in fact
```
val serializer: ExpressionEncoder.Serializer[Array[T]] =
ExpressionEncoder[Array[T]].createSerializer()
val applied: InternalRow = serializer.apply(array)
val converted: ArrayData = applied.getArray(0)
```
where `getArray(0)` is a call to
https://github.com/apache/spark/blob/5264164a67df498b73facae207eda12ee133be7d/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/SpecializedGetters.java#L56
which returns ArrayData, not an element of array from it.
I do not see that we are able to get element of this "array" from ArrayData
without specifying tables of methods to specific underlying array we want from
it (like for Boolean we want ArrayData.toBooleanArray and so on).
https://github.com/apache/spark/blob/fa0d4bf69929c5acd676d602e758a969713d19d8/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/ArrayData.scala
do not allow to inquiry type of a data it stores (cause it's a blob in memory
at the end, I suppose?)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]