You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/03/02 01:04:48 UTC

[GitHub] [spark] WeichenXu123 commented on a change in pull request #35699: [SPARK-38363][SQL] Avoid runtime error in Dataset.summary()/Dataset.describe() when ANSI mode is on

WeichenXu123 commented on a change in pull request #35699:
URL: https://github.com/apache/spark/pull/35699#discussion_r817265713



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/stat/StatFunctions.scala
##########
@@ -246,14 +246,19 @@ object StatFunctions extends Logging {
     }
     require(percentiles.forall(p => p >= 0 && p <= 1), "Percentiles must be in the range [0, 1]")
 
+    def castAsDoubleIfNecessary(e: Expression): Expression = if (e.dataType == StringType) {
+      TryCast(e, DoubleType)

Review comment:
       Does try cast return Null if casting failed ?




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org