You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/10/11 11:07:02 UTC

[GitHub] [spark] gemelen commented on a change in pull request #29995: [WIP][SPARK-33080][BUILD] Replace fatal warnings snippet

gemelen commented on a change in pull request #29995:
URL: https://github.com/apache/spark/pull/29995#discussion_r502900514



##########
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:
       I've looked more at this assert and it seems to me that it should never pass, cause `ArrayData` does not have "is-a" relation with `T` type (`ArrayData` even is not a wrapper to `Array[T]` which also has no "is-a" relation with `T` according to Scala types).
   
   Previously, it caused warnings
   ```
   [warn] /tmp/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/UnsafeArraySuite.scala:77:34: abstract type T is unchecked since it is eliminated by erasure
   [warn] /tmp/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/UnsafeArraySuite.scala:77:11: abstract type T is unchecked since it is eliminated by erasure
   ```
   but they were not enforced by custom warning processor.
   
   @srowen @hvanhovell @dongjoon-hyun is my understanding is correct here?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org