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

    https://github.com/apache/spark/pull/20986#discussion_r179644816
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeProjection.scala
 ---
    @@ -176,6 +141,23 @@ object GenerateUnsafeProjection extends 
CodeGenerator[Seq[Expression], UnsafePro
         """.trim
       }
     
    +
    +  private def writeArrayToBuffer(
    +    ctx: CodegenContext,
    +    input: String,
    +    index: String,
    +    elementType: DataType,
    +    rowWriter: String): String = {
    +    val previousCursor = ctx.freshName("previousCursor")
    +    s"""
    +       // Remember the current cursor so that we can calculate how many 
bytes are
    +       // written later.
    +       final int $previousCursor = $rowWriter.cursor();
    +       ${writeArrayToBuffer(ctx, input, elementType, rowWriter)}
    +       $rowWriter.setOffsetAndSizeFromPreviousCursor($index, 
$previousCursor);
    +     """
    --- End diff --
    
    +1


---

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

Reply via email to