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

    https://github.com/apache/spark/pull/21909#discussion_r206985104
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FailureSafeParser.scala
 ---
    @@ -56,9 +57,14 @@ class FailureSafeParser[IN](
         }
       }
     
    +  private val skipParsing = optimizeEmptySchema && schema.isEmpty
       def parse(input: IN): Iterator[InternalRow] = {
         try {
    -      rawParser.apply(input).toIterator.map(row => toResultRow(Some(row), 
() => null))
    +     if (skipParsing) {
    +       Iterator.single(InternalRow.empty)
    +     } else {
    +       rawParser.apply(input).toIterator.map(row => toResultRow(Some(row), 
() => null))
    --- End diff --
    
    Could you add a test case for counting both CSV and JSON source when the 
files having broken records? Any behavior change after this PR?


---

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

Reply via email to