HyukjinKwon commented on a change in pull request #27524: [WIP][SQL] Support 
`SimpleDateFormat` and `FastDateFormat` as legacy date/timestamp formatters
URL: https://github.com/apache/spark/pull/27524#discussion_r377421120
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
 ##########
 @@ -831,12 +831,11 @@ abstract class ToTimestamp
         }
       case StringType =>
         val zid = ctx.addReferenceObj("zoneId", zoneId, 
classOf[ZoneId].getName)
-        val locale = ctx.addReferenceObj("locale", Locale.US)
         val tf = TimestampFormatter.getClass.getName.stripSuffix("$")
         nullSafeCodeGen(ctx, ev, (string, format) => {
           s"""
             try {
-              ${ev.value} = $tf$$.MODULE$$.apply($format.toString(), $zid, 
$locale)
+              ${ev.value} = 
$tf$$.MODULE$$.withStrongLegacy($format.toString(), $zid)
 
 Review comment:
   quick question, why `SIMPLE_DATE_FORMAT` alone has `withStrongLegacy` - is 
it because `SIMPLE_DATE_FORMAT` is an enum, and tricky for the codegen part to 
reference? We could just simply define string variables for them too. Seems 
like it's better to keep it consistent to one side as this legacy code part is 
already pretty difficult to follow and read.

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