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

    https://github.com/apache/spark/pull/19827#discussion_r153383752
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeProjection.scala
 ---
    @@ -167,9 +160,20 @@ object GenerateUnsafeProjection extends 
CodeGenerator[Seq[Expression], UnsafePro
             }
         }
     
    +    val writeFieldsCode = if (isTopLevel && row == null) {
    --- End diff --
    
    hmm, can the row be null here? I think `GenerateUnsafeProjection` is 
proposed to use to project against an input row.
    
    Actually, I think it is confusing naming. `ctx.INPUT_ROW` is just used as 
the name of input row. It doesn't actually want to refer `ctx.INPUT_ROW` here.
    
    ```scala
    public UnsafeRow apply(InternalRow ${ctx.INPUT_ROW}) {
      ${eval.code.trim}
      return ${eval.value};
    }
    ```


---

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

Reply via email to