Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18865
  
    A use case might be:
    
    ```
    echo '{"field": 1
     {"field" 2}
     {"field": 3}' >/tmp/sample.json
    ```
    
    
    ```scala
    val file = "/tmp/sample.json"
    val dfFromFile = spark.read.schema("field BYTE, _corrupt_record 
STRING").json(file)
    dfFromFile.show(false)
    dfFromFile.filter($"_corrupt_record".isNotNull).count()
    dfFromFile.filter($"_corrupt_record".isNull).count()
    dfFromFile.select($"_corrupt_record").show()
    ```
    
    ```
    scala> dfFromFile.show(false)
    +-----+---------------+
    |field|_corrupt_record|
    +-----+---------------+
    |null |{"field": 1    |
    |null | {"field" 2}   |
    |3    |null           |
    +-----+---------------+
    
    
    scala> dfFromFile.filter($"_corrupt_record".isNotNull).count()
    res1: Long = 2
    
    scala> dfFromFile.filter($"_corrupt_record".isNull).count()
    res2: Long = 1
    
    scala> dfFromFile.select($"_corrupt_record").show()
    +---------------+
    |_corrupt_record|
    +---------------+
    |    {"field": 1|
    |    {"field" 2}|
    |           null|
    +---------------+
    ```
    
    I was thinking of avoiding to blacklist a case which works before without 
an exception but it looks we (at least I) are less sure if it is a bug.


---
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