Github user MaxGekk commented on the issue:

    https://github.com/apache/spark/pull/20894
  
    @gatorsmile For example, Spark is case sensitive for jsons:
    ```
    cat ./case_sesitive.json
    {"FIELD1": 1}
    ```
    If schema is specified with field name "field1":
    ```
    val schema=new StructType().add("field1", IntegerType)
    spark.read.schema(schema).json("case_sesitive.json").show
    ```
    it cannot match field:
    ```
    +------+
    |field1|
    +------+
    |  null|
    +------+
    ```
    but if schema's field and actual json field in the same case:
    ```
    val schema=new StructType().add("FIELD1", IntegerType)
    spark.read.schema(schema).json("case_sesitive.json").show
    ```
    ```
    +------+
    |FIELD1|
    +------+
    |     1|
    +------+
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to