Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20626#discussion_r168909963
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala
 ---
    @@ -278,40 +278,45 @@ case class Literal (value: Any, dataType: DataType) 
extends LeafExpression {
     
       override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
         val javaType = ctx.javaType(dataType)
    -    // change the isNull and primitive to consts, to inline them
         if (value == null) {
    -      ev.isNull = "true"
    -      ev.copy(s"final $javaType ${ev.value} = 
${ctx.defaultValue(dataType)};")
    +      val defaultValueLiteral = ctx.defaultValue(javaType) match {
    +        case "null" => s"(($javaType)null)"
    --- End diff --
    
    does it work for primitive types?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to