Skip to content

Commit e0054b8

Browse files
committed
[SPARK-26424][SQL][FOLLOWUP] Fix DateFormatClass/UnixTime codegen
## What changes were proposed in this pull request? This PR fixes the codegen bug introduced by #23358 . - https://amplab.cs.berkeley.edu/jenkins/view/Spark%20QA%20Test%20(Dashboard)/job/spark-master-test-maven-hadoop-2.7-ubuntu-scala-2.11/158/ ``` Line 44, Column 93: A method named "apply" is not declared in any enclosing class nor any supertype, nor through a static import ``` ## How was this patch tested? Manual. `DateExpressionsSuite` should be passed with Scala-2.11. Closes #23394 from dongjoon-hyun/SPARK-26424. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 5bef4fe commit e0054b8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ case class DateFormatClass(left: Expression, right: Expression, timeZoneId: Opti
571571
val tz = ctx.addReferenceObj("timeZone", timeZone)
572572
val locale = ctx.addReferenceObj("locale", Locale.US)
573573
defineCodeGen(ctx, ev, (timestamp, format) => {
574-
s"""UTF8String.fromString($tf.apply($format.toString(), $tz, $locale)
574+
s"""UTF8String.fromString($tf$$.MODULE$$.apply($format.toString(), $tz, $locale)
575575
.format($timestamp))"""
576576
})
577577
}
@@ -741,11 +741,11 @@ abstract class UnixTime
741741
case StringType =>
742742
val tz = ctx.addReferenceObj("timeZone", timeZone)
743743
val locale = ctx.addReferenceObj("locale", Locale.US)
744-
val dtu = TimestampFormatter.getClass.getName.stripSuffix("$")
744+
val tf = TimestampFormatter.getClass.getName.stripSuffix("$")
745745
nullSafeCodeGen(ctx, ev, (string, format) => {
746746
s"""
747747
try {
748-
${ev.value} = $dtu.apply($format.toString(), $tz, $locale)
748+
${ev.value} = $tf$$.MODULE$$.apply($format.toString(), $tz, $locale)
749749
.parse($string.toString()) / 1000000L;
750750
} catch (java.lang.IllegalArgumentException e) {
751751
${ev.isNull} = true;

0 commit comments

Comments
 (0)