AngersZhuuuu commented on a change in pull request #30421:
URL: https://github.com/apache/spark/pull/30421#discussion_r529657074



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -503,13 +503,32 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with 
SQLConfHelper with Logg
     }
   }
 
+  private def convertTypeConstructedLiteralToString(literal: Literal): String 
= literal match {
+    case Literal(data: Int, dataType: DateType) =>
+      UTF8String.fromString(
+        DateFormatter(getZoneId(SQLConf.get.sessionLocalTimeZone))
+          .format(data)).toString
+    case Literal(data: Long, dataType: TimestampType) =>
+      UTF8String.fromString(
+        
TimestampFormatter.getFractionFormatter(getZoneId(SQLConf.get.sessionLocalTimeZone))
+          .format(data)).toString
+    case Literal(data: CalendarInterval, dataType: CalendarIntervalType) =>
+      UTF8String.fromString(data.toString).toString
+    case Literal(data: Array[Byte], dataType: BinaryType) =>
+      UTF8String.fromBytes(data).toString
+    case Literal(data, dataType) =>
+      UTF8String.fromString(data.toString).toString

Review comment:
       Add back...Seems I add this case  avoid build problem.
   ```
   [error] 
/home/jenkins/workspace/SparkPullRequestBuilder@3/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:506:81:
 Exhaustivity analysis reached max recursion depth, not all missing cases are 
reported.
   [error] (Please try with scalac -Ypatmat-exhaust-depth 40 or 
-Ypatmat-exhaust-depth off.)
   [error]   private def convertTypeConstructedLiteralToString(literal: 
Literal): String = literal match {
   [error]                                                                      
           ^
   [error] one error found
   ```




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to