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

    https://github.com/apache/spark/pull/16386#discussion_r101683719
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonParser.scala
 ---
    @@ -394,36 +447,30 @@ class JacksonParser(
       }
     
       /**
    -   * Parse the string JSON input to the set of [[InternalRow]]s.
    +   * Parse the JSON input to the set of [[InternalRow]]s.
    +   *
    +   * @param recordLiteral an optional function that will be used to 
generate
    +   *   the corrupt record text instead of record.toString
        */
    -  def parse(input: String): Seq[InternalRow] = {
    -    if (input.trim.isEmpty) {
    -      Nil
    -    } else {
    -      try {
    -        Utils.tryWithResource(factory.createParser(input)) { parser =>
    -          parser.nextToken()
    -          rootConverter.apply(parser) match {
    -            case null => failedRecord(input)
    -            case row: InternalRow => row :: Nil
    -            case array: ArrayData =>
    -              // Here, as we support reading top level JSON arrays and 
take every element
    -              // in such an array as a row, this case is possible.
    -              if (array.numElements() == 0) {
    -                Nil
    -              } else {
    -                array.toArray[InternalRow](schema)
    -              }
    -            case _ =>
    -              failedRecord(input)
    +  def parse[T](
    +      record: T,
    +      createParser: (JsonFactory, T) => JsonParser,
    +      recordLiteral: T => UTF8String): Seq[InternalRow] = {
    --- End diff --
    
    nit: `recordToString`?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to