This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-2.4 by this push:
new 7b7a8fe [SPARK-34743][SQL][TESTS] ExpressionEncoderSuite should use
deepEquals when we expect `array of array`
7b7a8fe is described below
commit 7b7a8fe3700d7ec731f481d48a1c3283f954b0db
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Mon Mar 15 02:30:54 2021 -0700
[SPARK-34743][SQL][TESTS] ExpressionEncoderSuite should use deepEquals when
we expect `array of array`
### What changes were proposed in this pull request?
This PR aims to make `ExpressionEncoderSuite` to use `deepEquals` instead
of `equals` when `input` is `array of array`.
This comparison code itself was added by SPARK-11727 at Apache Spark 1.6.0.
### Why are the changes needed?
Currently, the interpreted mode fails for `array of array` because the
following line is used.
```
Arrays.equals(b1.asInstanceOf[Array[AnyRef]],
b2.asInstanceOf[Array[AnyRef]])
```
### Does this PR introduce _any_ user-facing change?
No. This is a test-only PR.
### How was this patch tested?
Pass the existing CIs.
Closes #31837 from dongjoon-hyun/SPARK-34743.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 363a7f0722522898337b926224bf46bb9c32176c)
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../spark/sql/catalyst/encoders/ExpressionEncoderSuite.scala | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoderSuite.scala
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoderSuite.scala
index f8d252f..1b02fa5 100644
---
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoderSuite.scala
+++
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoderSuite.scala
@@ -164,10 +164,9 @@ class ExpressionEncoderSuite extends
CodegenInterpretedPlanTest with AnalysisTes
encodeDecodeTest(Array.empty[Int], "empty array of int")
encodeDecodeTest(Array.empty[String], "empty array of string")
- encodeDecodeTest(Array(Array(31, -123), null, Array(4, 67)), "array of array
of int",
- useFallback = true)
+ encodeDecodeTest(Array(Array(31, -123), null, Array(4, 67)), "array of array
of int")
encodeDecodeTest(Array(Array("abc", "xyz"), Array[String](null), null,
Array("1", null, "2")),
- "array of array of string", useFallback = true)
+ "array of array of string")
encodeDecodeTest(Map(1 -> "a", 2 -> "b"), "map")
encodeDecodeTest(Map(1 -> "a", 2 -> null), "map with null")
@@ -408,10 +407,8 @@ class ExpressionEncoderSuite extends
CodegenInterpretedPlanTest with AnalysisTes
val isCorrect = (input, convertedBack) match {
case (b1: Array[Byte], b2: Array[Byte]) => Arrays.equals(b1, b2)
case (b1: Array[Int], b2: Array[Int]) => Arrays.equals(b1, b2)
- case (b1: Array[Array[_]], b2: Array[Array[_]]) =>
- Arrays.deepEquals(b1.asInstanceOf[Array[AnyRef]],
b2.asInstanceOf[Array[AnyRef]])
case (b1: Array[_], b2: Array[_]) =>
- Arrays.equals(b1.asInstanceOf[Array[AnyRef]],
b2.asInstanceOf[Array[AnyRef]])
+ Arrays.deepEquals(b1.asInstanceOf[Array[AnyRef]],
b2.asInstanceOf[Array[AnyRef]])
case (left: Comparable[_], right: Comparable[_]) =>
left.asInstanceOf[Comparable[Any]].compareTo(right) == 0
case _ => input == convertedBack
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]