itholic commented on code in PR #45699:
URL: https://github.com/apache/spark/pull/45699#discussion_r1539571833


##########
python/pyspark/sql/connect/session.py:
##########
@@ -418,6 +425,28 @@ def createDataFrame(
             # If no schema supplied by user then get the names of columns only
             if schema is None:
                 _cols = [str(x) if not isinstance(x, str) else x for x in 
data.columns]
+                infer_pandas_dict_as_map = (
+                    
str(self.conf.get("spark.sql.execution.pandas.inferPandasDictAsMap")).lower()
+                    == "true"
+                )
+                if infer_pandas_dict_as_map:
+                    struct = StructType()
+                    pa_schema = pa.Schema.from_pandas(data)
+                    spark_type: Union[MapType, DataType]
+                    for field in pa_schema:
+                        field_type = field.type
+                        if isinstance(field_type, pa.StructType):

Review Comment:
   What does nested type cases mean you are concerned about? Maybe do you mean 
a `dict` within a `dict`, or a `list` within a `dict` for example? If so, the 
result depends entirely on Arrow's inferring logic, so it is difficult to give 
an exact answer for all cases. If you have a specific case that you're 
concerned about, let me add some testing to make sure it works.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to