yaooqinn commented on a change in pull request #27867: 
[SPARK-31111][SQL][Tests] Fix interval output issue in ExtractBenchmark
URL: https://github.com/apache/spark/pull/27867#discussion_r390732419
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/ExtractBenchmark.scala
 ##########
 @@ -56,9 +56,11 @@ object ExtractBenchmark extends SqlBasedBenchmark {
     }
   }
 
-  private def castExpr(from: String): String = from match {
+  private def castExpr(from: String, toStr: Boolean = false): String = from 
match {
     case "timestamp" => "cast(id as timestamp)"
     case "date" => "cast(cast(id as timestamp) as date)"
+    case "interval" if toStr => "cast((cast(cast(id as timestamp) as date) - 
date'0001-01-01') + " +
 
 Review comment:
   Hmm, in this benchmark, there are 2 kinds of tests, one is 
`extract/date_part` and the other is `string to interval`, the latter fails 
type checking when saving.
   Or shall we just remove the `string to interval` case here 
https://github.com/apache/spark/pull/27867/files#diff-b89131adf146fef7cd6e3db381fd0807L111

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to