parthchandra commented on code in PR #3768:
URL: https://github.com/apache/datafusion-comet/pull/3768#discussion_r2984013041


##########
spark/src/main/spark-3.4/org/apache/spark/sql/comet/shims/ShimSparkErrorConverter.scala:
##########
@@ -44,6 +44,24 @@ trait ShimSparkErrorConverter {
   private def sqlCtx(context: Array[QueryContext]): SQLQueryContext =
     context.headOption.map(_.asInstanceOf[SQLQueryContext]).getOrElse(null)
 
+  private def parseFloatLiteral(value: String): Float = {
+    value.toLowerCase match {
+      case "inf" | "+inf" | "infinity" | "+infinity" => Float.PositiveInfinity
+      case "-inf" | "-infinity" => Float.NegativeInfinity
+      case "nan" | "+nan" | "-nan" => Float.NaN
+      case _ => value.toFloat
+    }
+  }
+
+  private def parseDoubleLiteral(value: String): Double = {
+    value.toLowerCase match {

Review Comment:
   In `conversion_funcs/numeric.rs:spark_cast_nonintegral_numeric_to_integral` 
the calls to `cast_float_to_int16_down` and `cast_float_to_int32_up` explicitly 
format the string with `"{:e}D"` (a suffix `D`). 
   I think `inf` and `nan` will get this `D` suffix and the resultant string 
`infD` or `nanD` would not match.
   The unit tests below will not catch this either.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to