dongjoon-hyun commented on a change in pull request #25331: [SPARK-27768][SQL] 
Support Infinity/NaN-related float/double literals case-insensitively
URL: https://github.com/apache/spark/pull/25331#discussion_r313193830
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
 ##########
 @@ -1045,4 +1045,34 @@ class CastSuite extends SparkFunSuite with 
ExpressionEvalHelper {
         Cast(Literal(134.12), DecimalType(3, 2)), "cannot be represented")
     }
   }
+
+  test("Process Infinity, -Infinity, NaN in case insensitive manner") {
+    checkEvaluation(cast("inf", FloatType), Float.PositiveInfinity)
+    checkEvaluation(cast("+inf", FloatType), Float.PositiveInfinity)
+    checkEvaluation(cast("infinity", FloatType), Float.PositiveInfinity)
+    checkEvaluation(cast("+infiNity", FloatType), Float.PositiveInfinity)
+    checkEvaluation(cast(" infinity ", FloatType), Float.PositiveInfinity)
+    checkEvaluation(cast("-infinity", FloatType), Float.NegativeInfinity)
+    checkEvaluation(cast("-infiniTy", FloatType), Float.NegativeInfinity)
+    checkEvaluation(cast("  -infinity  ", FloatType), Float.NegativeInfinity)
+    checkEvaluation(cast("  -inf  ", FloatType), Float.NegativeInfinity)
 
 Review comment:
   Do we have negative cases returning `NULL` in somewhere else?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to