You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Takuya Ueshin (Jira)" <ji...@apache.org> on 2023/03/30 21:11:00 UTC

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

Takuya Ueshin created SPARK-42982:
-------------------------------------

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


{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