Skip to content

Commit aeec6a7

Browse files
huangtianhuadongjoon-hyun
huangtianhua
authored andcommitted
[SPARK-28433][SQL][TEST] Remove hardware-dependent 0.0/0.0 and NaN comparison assertions
## What changes were proposed in this pull request? This PR removes a few hardware-dependent assertions which can cause a failure in `aarch64`. **x86_64** ``` rootdonotdel-openlab-allinone-l00242678:/home/ubuntu# uname -a Linux donotdel-openlab-allinone-l00242678 4.4.0-154-generic apache-spark-on-k8s#181-Ubuntu SMP Tue Jun 25 05:29:03 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux scala> import java.lang.Float.floatToRawIntBits import java.lang.Float.floatToRawIntBits scala> floatToRawIntBits(0.0f/0.0f) res0: Int = -4194304 scala> floatToRawIntBits(Float.NaN) res1: Int = 2143289344 ``` **aarch64** ``` [rootarm-huangtianhua spark]# uname -a Linux arm-huangtianhua 4.14.0-49.el7a.aarch64 #1 SMP Tue Apr 10 17:22:26 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux scala> import java.lang.Float.floatToRawIntBits import java.lang.Float.floatToRawIntBits scala> floatToRawIntBits(0.0f/0.0f) res1: Int = 2143289344 scala> floatToRawIntBits(Float.NaN) res2: Int = 2143289344 ``` ## How was this patch tested? Pass the Jenkins (This removes the test coverage). Closes apache#25186 from huangtianhua/special-test-case-for-aarch64. Authored-by: huangtianhua <huangtianhua@huawei.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
1 parent 4196d7b commit aeec6a7

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)