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/04/13 09:32:00 UTC

[jira] [Assigned] (SPARK-42982) Fix createDataFrame from pandas with map type

     [ https://issues.apache.org/jira/browse/SPARK-42982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hyukjin Kwon reassigned SPARK-42982:
------------------------------------

    Assignee: Takuya Ueshin

> Fix createDataFrame from pandas with map type
> ---------------------------------------------
>
>                 Key: SPARK-42982
>                 URL: https://issues.apache.org/jira/browse/SPARK-42982
>             Project: Spark
>          Issue Type: Sub-task
>          Components: Connect
>    Affects Versions: 3.4.0
>            Reporter: Takuya Ueshin
>            Assignee: Takuya Ueshin
>            Priority: Major
>
> {code:python}
> >>> import pandas as pd
> >>>
> >>> map_data = [{"a": 1}, {"b": 2, "c": 3}, {}, None, {"d": None}]
> >>> pdf = pd.DataFrame({"id": [0, 1, 2, 3, 4], "m": map_data})
> >>> schema = "id long, m map<string, long>"
> >>> spark.createDataFrame(pdf, schema=schema)
> Traceback (most recent call last):
> ...
> pyspark.errors.exceptions.connect.AnalysisException: [INVALID_COLUMN_OR_FIELD_DATA_TYPE] Column or field `col_1` is of type "STRUCT<col_0: BIGINT, col_1: BIGINT, col_2: BIGINT, col_3: VOID>" while it's required to be "MAP<STRING, BIGINT>".
> {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