You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hyukjin Kwon (Jira)" <ji...@apache.org> on 2023/01/02 07:18:00 UTC

[jira] [Created] (SPARK-41810) SparkSession.createDataFrame does not respect the column names in the dictionary

Hyukjin Kwon created SPARK-41810:
------------------------------------

             Summary: SparkSession.createDataFrame does not respect the column names in the dictionary
                 Key: SPARK-41810
                 URL: https://issues.apache.org/jira/browse/SPARK-41810
             Project: Spark
          Issue Type: Sub-task
          Components: Connect
    Affects Versions: 3.4.0
            Reporter: Hyukjin Kwon


{code}
Failed example:
    with tempfile.TemporaryDirectory() as d:
        # Write a DataFrame into a JSON file
        spark.createDataFrame(
            [{"age": 100, "name": "Hyukjin Kwon"}]
        ).write.mode("overwrite").format("json").save(d)

        # Read the JSON file as a DataFrame.
        spark.read.format('json').load(d).show()
Expected:
    +---+------------+
    |age|        name|
    +---+------------+
    |100|Hyukjin Kwon|
    +---+------------+
Got:
    +---+------------+
    | _1|          _2|
    +---+------------+
    |100|Hyukjin Kwon|
    +---+------------+
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org