Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/21643#discussion_r198189030 --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/ComplexDataSuite.scala --- @@ -104,4 +104,13 @@ class ComplexDataSuite extends SparkFunSuite { // The copied data should not be changed externally. assert(copied.getStruct(0, 1).getUTF8String(0).toString == "a") } + + test("SPARK-24659: GenericArrayData.equals should respect element type differences") { + // Spark SQL considers array<int> and array<long> to be incompatible, + // so an underlying implementation of array type should return false in this case. + val array1 = new GenericArrayData(Array[Int](123)) + val array2 = new GenericArrayData(Array[Long](123L)) + + assert(!array1.equals(array2)) --- End diff -- without schema, Spark can never compare a generic and an unsafe array. This fix is not a real bug fix, but makes the `GenericArrayData` more clear about equals semantic, which is good to have, and might be useful when writing tests.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org