srowen commented on a change in pull request #24889: [SPARK-28072][SQL] Use 
`Iso8601TimestampFormatter` in `FromUnixTime` codegen to fix ICCE in JDK9+
URL: https://github.com/apache/spark/pull/24889#discussion_r294298984
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
 ##########
 @@ -859,11 +859,11 @@ case class FromUnixTime(sec: Expression, format: 
Expression, timeZoneId: Option[
     } else {
       val zid = ctx.addReferenceObj("zoneId", zoneId, classOf[ZoneId].getName)
       val locale = ctx.addReferenceObj("locale", Locale.US)
-      val tf = TimestampFormatter.getClass.getName.stripSuffix("$")
+      val tf = classOf[Iso8601TimestampFormatter].getName
       nullSafeCodeGen(ctx, ev, (seconds, f) => {
         s"""
         try {
-          ${ev.value} = UTF8String.fromString($tf.apply($f.toString(), $zid, 
$locale).
 
 Review comment:
   Hm, yeah I'm a little confused too. There is a `TimestampFormatter.apply` 
method defined on the companion object. `TimestampFormatter` is a trait 
(interface). You're allowed static methods in interfaces in Java 8. I wonder 
indeed if it's a _Scala_ issue somehow with how the method is generated, like 
it's not quite tagged as static.
   
   Anyway I agree with the fix and we can leave a todo, maybe, about what we 
know of the issue.

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