maropu commented on a change in pull request #25331: [SPARK-27768][SQL]
Infinity, -Infinity, NaN should be recognized in a case insensitive manner.
URL: https://github.com/apache/spark/pull/25331#discussion_r309937046
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -547,7 +547,17 @@ case class Cast(child: Expression, dataType: DataType,
timeZoneId: Option[String
private[this] def castToDouble(from: DataType): Any => Any = from match {
case StringType =>
buildCast[UTF8String](_, s => try s.toString.toDouble catch {
- case _: NumberFormatException => null
+ case _: NumberFormatException =>
+ val str = s.trim.toString
Review comment:
Its just a check; do we support this case, e.g., ' infinity '? (I know
pg does so though). If we support this case, IMO you'd be better to clearly
describe in the PR description, which case this PR try to support.
----------------------------------------------------------------
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]