Skip to content

Commit d7f2e37

Browse files
author
忍冬
committed
fix equlity for WrappedArray.ofRef
1 parent 8d009e1 commit d7f2e37

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,16 @@ object QueryTest {
290290
Row.fromSeq(row.toSeq.map {
291291
case null => null
292292
case d: java.math.BigDecimal => BigDecimal(d)
293+
// Equality of WrappedArray differs for AnyVal and AnyRef in Scala 2.12.2+
294+
case seq: Seq[_] => seq.map {
295+
case b: java.lang.Byte => b.byteValue
296+
case s: java.lang.Short => s.shortValue
297+
case i: java.lang.Integer => i.intValue
298+
case l: java.lang.Long => l.longValue
299+
case f: java.lang.Float => f.floatValue
300+
case d: java.lang.Double => d.doubleValue
301+
case x => x
302+
}
293303
// Convert array to Seq for easy equality check.
294304
case b: Array[_] => b.toSeq
295305
case r: Row => prepareRow(r)

0 commit comments

Comments
 (0)