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



##########
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 convertTypedLiteralToString(literal: Literal): String = literal 
match {
+    case Literal(data: Int, _: DateType) =>
+      UTF8String.fromString(

Review comment:
       Could you clarify why do you need the conversion: String -> UTF8String 
-> String 

##########
File path: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
##########
@@ -2583,6 +2583,27 @@ abstract class SQLQuerySuiteBase extends QueryTest with 
SQLTestUtils with TestHi
       }
     }
   }
+
+  test("SPARK-33474: Support TypeConstructed partition spec value") {

Review comment:
       Why did you place the test in `sql/hive`? Are your changes hive specific?

##########
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 convertTypedLiteralToString(literal: Literal): String = literal 
match {
+    case Literal(data: Int, _: DateType) =>
+      UTF8String.fromString(
+        DateFormatter(getZoneId(SQLConf.get.sessionLocalTimeZone))
+          .format(data)).toString
+    case Literal(data: Long, _: TimestampType) =>
+      UTF8String.fromString(
+        
TimestampFormatter.getFractionFormatter(getZoneId(SQLConf.get.sessionLocalTimeZone))
+          .format(data)).toString
+    case Literal(data: CalendarInterval, _: CalendarIntervalType) =>
+      UTF8String.fromString(data.toString).toString

Review comment:
       ```suggestion
       case Literal(data: Int, _: DateType) =>
         DateFormatter(getZoneId(SQLConf.get.sessionLocalTimeZone)).format(data)
       case Literal(data: Long, _: TimestampType) =>
         
TimestampFormatter.getFractionFormatter(getZoneId(SQLConf.get.sessionLocalTimeZone))
           .format(data)
       case Literal(data: CalendarInterval, _: CalendarIntervalType) => 
data.toString
   ```




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