File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
sql/core/src/test/scala/org/apache/spark/sql Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -743,18 +743,27 @@ class DataFrameSuite extends QueryTest with SQLTestUtils {
743
743
df.col(" t.``" )
744
744
}
745
745
746
- test(" SPARK-8797: sort by float column containing NaN" ) {
746
+ test(" SPARK-8797: sort by float column containing NaN should not crash " ) {
747
747
val inputData = Seq .fill(10 )(Tuple1 (Float .NaN )) ++ (1 to 1000 ).map(x => Tuple1 (x.toFloat))
748
748
val df = Random .shuffle(inputData).toDF(" a" )
749
749
df.orderBy(" a" ).collect()
750
750
}
751
751
752
- test(" SPARK-8797: sort by double column containing NaN" ) {
752
+ test(" SPARK-8797: sort by double column containing NaN should not crash " ) {
753
753
val inputData = Seq .fill(10 )(Tuple1 (Double .NaN )) ++ (1 to 1000 ).map(x => Tuple1 (x.toDouble))
754
754
val df = Random .shuffle(inputData).toDF(" a" )
755
755
df.orderBy(" a" ).collect()
756
756
}
757
757
758
+ test(" SPARK-9146: NaN is greater than all other non-NaN numeric values" ) {
759
+ val maxDouble = Seq (Double .NaN , Double .PositiveInfinity , Double .MaxValue )
760
+ .map(Tuple1 .apply).toDF(" a" ).selectExpr(" max(a)" ).first()
761
+ assert(java.lang.Double .isNaN(maxDouble.getDouble(0 )))
762
+ val maxFloat = Seq (Float .NaN , Float .PositiveInfinity , Float .MaxValue )
763
+ .map(Tuple1 .apply).toDF(" a" ).selectExpr(" max(a)" ).first()
764
+ assert(java.lang.Float .isNaN(maxFloat.getFloat(0 )))
765
+ }
766
+
758
767
test(" SPARK-8072: Better Exception for Duplicate Columns" ) {
759
768
// only one duplicate column present
760
769
val e = intercept[org.apache.spark.sql.AnalysisException ] {
You can’t perform that action at this time.
0 commit comments