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

    https://github.com/apache/spark/pull/19492#discussion_r144755348
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonParser.scala
 ---
    @@ -89,6 +95,24 @@ class JacksonParser(
     
       /**
        * Create a converter which converts the JSON documents held by the 
`JsonParser`
    +   * to a value according to a desired schema. This is an overloaded 
method to the
    +   * previous one which allows to handle array of primitive types.
    +   */
    +  private def makeRootConverter(at: ArrayType): JsonParser => Seq[Any] = {
    +    (parser: JsonParser) => parseJsonToken[Seq[Any]](parser, at) {
    +      case START_ARRAY =>
    +        val array = convertArray(parser, makeConverter(at.elementType))
    +        if (array.numElements() == 0) {
    +          Nil
    +        } else {
    +          array.toArray(at.elementType).toSeq
    +        }
    +      case _ => Nil
    --- End diff --
    
    Should we return `Nil` when it is not parsed to array? The original 
`makeRootConverter` didn't do this.


---

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

Reply via email to