Github user MaxGekk commented on a diff in the pull request: https://github.com/apache/spark/pull/21643#discussion_r198268375 --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/ComplexDataSuite.scala --- @@ -104,4 +104,38 @@ 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") { + import scala.reflect.ClassTag + + // Expected positive cases + def arraysShouldEqual[T: ClassTag](element: T*): Unit = { + val array1 = new GenericArrayData(Array[T](element: _*)) + val array2 = new GenericArrayData(Array[T](element: _*)) + assert(array1.equals(array2)) + } + arraysShouldEqual(true, false) // Boolean + arraysShouldEqual(0.toByte, 123.toByte, (-123).toByte) // Byte + arraysShouldEqual(0.toShort, 123.toShort, (-256).toShort) // Short + arraysShouldEqual(0, 123, -65536) // Int + arraysShouldEqual(0L, 123L, -65536L) // Long --- End diff -- It is not important but if you are checking corner cases, probably, it makes sense to pass values like `Long.MinValue` and `Double.MaxValue`
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org