Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18030#discussion_r117301990
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeProjection.scala
 ---
    @@ -50,10 +50,15 @@ object GenerateUnsafeProjection extends 
CodeGenerator[Seq[Expression], UnsafePro
           fieldTypes: Seq[DataType],
           bufferHolder: String): String = {
         val fieldEvals = fieldTypes.zipWithIndex.map { case (dt, i) =>
    -      val fieldName = ctx.freshName("fieldName")
    -      val code = s"final ${ctx.javaType(dt)} $fieldName = 
${ctx.getValue(input, dt, i.toString)};"
    -      val isNull = s"$input.isNullAt($i)"
    -      ExprCode(code, isNull, fieldName)
    +      val javaType = ctx.javaType(dt)
    +      val isNullVar = ctx.freshName("isNull")
    +      val valueVar = ctx.freshName("value")
    +      val defaultValue = ctx.defaultValue(dt)
    +      val readValue = ctx.getValue(input, dt, i.toString)
    +      val code = s"""
    +               boolean $isNullVar = $input.isNullAt($i);
    +               $javaType $valueVar = $isNullVar ? $defaultValue : 
$readValue;"""
    --- End diff --
    
    Nit: style issue. Could you fix the indentation? Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to