spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cloud-fan <...@git.apache.org>
Subject [GitHub] spark pull request #19811: [SPARK-18016][SQL] Code Generation: Constant Pool...
Date Thu, 14 Dec 2017 08:24:57 GMT
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19811#discussion_r156878094
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
---
    @@ -484,14 +484,13 @@ case class WeekOfYear(child: Expression) extends UnaryExpression
with ImplicitCa
       override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
         nullSafeCodeGen(ctx, ev, time => {
           val cal = classOf[Calendar].getName
    -      val c = ctx.freshName("cal")
           val dtu = DateTimeUtils.getClass.getName.stripSuffix("$")
    -      ctx.addMutableState(cal, c,
    -        s"""
    -          $c = $cal.getInstance($dtu.getTimeZone("UTC"));
    -          $c.setFirstDayOfWeek($cal.MONDAY);
    -          $c.setMinimalDaysInFirstWeek(4);
    -         """)
    +      val c = ctx.addMutableState(cal, "cal",
    +        v => s"""
    +          $v = $cal.getInstance($dtu.getTimeZone("UTC"));
    --- End diff --
    
    let's use the new multiline string style here


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message