Skip to content

Commit cd5cf0c

Browse files
author
huangtianhua
committed
Remove incorrect assertions in scala tests
We ran unit tests of spark on aarch64 server, then found the values of floatToRawIntBits(0.0f / 0.0f) and floatToRawIntBits(Float.NaN) on aarch64 are same, after discuss with jdk-dev and scala community, we believe the value should depend on the architecture. This removes the incorrect assertions to make sure the tests fit all architectures.
1 parent 0512af1 commit cd5cf0c

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -725,13 +725,6 @@ class DataFrameAggregateSuite extends QueryTest with SharedSQLContext {
725725
}
726726

727727
test("SPARK-26021: NaN and -0.0 in grouping expressions") {
728-
import java.lang.Float.floatToRawIntBits
729-
import java.lang.Double.doubleToRawLongBits
730-
731-
// 0.0/0.0 and NaN are different values.
732-
assert(floatToRawIntBits(0.0f/0.0f) != floatToRawIntBits(Float.NaN))
733-
assert(doubleToRawLongBits(0.0/0.0) != doubleToRawLongBits(Double.NaN))
734-
735728
checkAnswer(
736729
Seq(0.0f, -0.0f, 0.0f/0.0f, Float.NaN).toDF("f").groupBy("f").count(),
737730
Row(0.0f, 2) :: Row(Float.NaN, 2) :: Nil)

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -697,13 +697,6 @@ class DataFrameWindowFunctionsSuite extends QueryTest with SharedSQLContext {
697697
}
698698

699699
test("NaN and -0.0 in window partition keys") {
700-
import java.lang.Float.floatToRawIntBits
701-
import java.lang.Double.doubleToRawLongBits
702-
703-
// 0.0/0.0 and NaN are different values.
704-
assert(floatToRawIntBits(0.0f/0.0f) != floatToRawIntBits(Float.NaN))
705-
assert(doubleToRawLongBits(0.0/0.0) != doubleToRawLongBits(Double.NaN))
706-
707700
val df = Seq(
708701
(Float.NaN, Double.NaN),
709702
(0.0f/0.0f, 0.0/0.0),

0 commit comments

Comments
 (0)