You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (Jira)" <ji...@apache.org> on 2023/01/02 08:58:00 UTC
[jira] [Commented] (SPARK-41810) SparkSession.createDataFrame does not respect the column names in the dictionary
[ https://issues.apache.org/jira/browse/SPARK-41810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17653537#comment-17653537 ]
Apache Spark commented on SPARK-41810:
--------------------------------------
User 'HyukjinKwon' has created a pull request for this issue:
https://github.com/apache/spark/pull/39344
> 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
> Priority: Major
>
> {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