[GitHub] [spark] cloud-fan commented on a change in pull request #27867: [SPARK-31111][SQL][Tests] Fix interval output issue in ExtractBenchmark

2020-03-10 Thread GitBox
cloud-fan commented on a change in pull request #27867: 
[SPARK-3][SQL][Tests] Fix interval output issue in ExtractBenchmark
URL: https://github.com/apache/spark/pull/27867#discussion_r390754252
 
 

 ##
 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:
   Maybe we should not use the noop sink here, but 
`df.queryExecution.toRDD.foreach(_ => ())`


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



[GitHub] [spark] cloud-fan commented on a change in pull request #27867: [SPARK-31111][SQL][Tests] Fix interval output issue in ExtractBenchmark

2020-03-10 Thread GitBox
cloud-fan commented on a change in pull request #27867: 
[SPARK-3][SQL][Tests] Fix interval output issue in ExtractBenchmark
URL: https://github.com/apache/spark/pull/27867#discussion_r390739470
 
 

 ##
 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:
   Why it's not a problem for date/timestamp?


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



[GitHub] [spark] cloud-fan commented on a change in pull request #27867: [SPARK-31111][SQL][Tests] Fix interval output issue in ExtractBenchmark

2020-03-10 Thread GitBox
cloud-fan commented on a change in pull request #27867: 
[SPARK-3][SQL][Tests] Fix interval output issue in ExtractBenchmark
URL: https://github.com/apache/spark/pull/27867#discussion_r390730564
 
 

 ##
 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:
   why we need to cast to string?


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