spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From HyukjinKwon <...@git.apache.org>
Subject [GitHub] spark pull request #18875: [SPARK-21513][SQL] Allow UDF to_json support conv...
Date Tue, 12 Sep 2017 00:43:11 GMT
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18875#discussion_r138228111
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonGenerator.scala
---
    @@ -193,14 +223,35 @@ private[sql] class JacksonGenerator(
        *
        * @param row The row to convert
        */
    -  def write(row: InternalRow): Unit = writeObject(writeFields(row, schema, rootFieldWriters))
    +  def write(row: InternalRow): Unit = {
    +    writeObject(writeFields(
    +      fieldWriters = rootFieldWriters,
    +      row = row,
    +      schema = dataType.asInstanceOf[StructType]))
    +  }
    +
    +
    +  /**
    +   * Transforms multiple `InternalRow`s or `MapData`s to JSON array using Jackson
    +   *
    +   * @param array The array of rows or maps to convert
    +   */
    +  def write(array: ArrayData): Unit = writeArray(writeArrayData(
    +    fieldWriter = arrElementWriter,
    +    array = array
    +  ))
    --- End diff --
    
    Let's change this one back to:
    
    ```scala
    def write(array: ArrayData): Unit = writeArray(writeArrayData(array, arrElementWriter))
    ```
    



---

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


Mime
View raw message