yaooqinn commented on a change in pull request #26418: [SPARK-29783][SQL] 
Support SQL Standard/ISO_8601 output style for interval type
URL: https://github.com/apache/spark/pull/26418#discussion_r345540456
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala
 ##########
 @@ -97,7 +100,12 @@ object HiveResult {
     case (null, _) => "null"
     case (s: String, StringType) => "\"" + s + "\""
     case (decimal, DecimalType()) => decimal.toString
-    case (interval, CalendarIntervalType) => interval.toString
+    case (interval: CalendarInterval, CalendarIntervalType) =>
+      SQLConf.get.intervalOutputStyle match {
+        case SQL_STANDARD => toSqlStandardString(interval)
+        case ISO_8601 => toIso8601String(interval)
+        case _ => toMultiUnitsString(interval)
 
 Review comment:
   1. we may need to escape some tests for `ThriftServerQueryTestSuite`, does 
it worth to do it separately?
   2.  IMO, add a new config here is enough to be Hive compatible

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

Reply via email to