HyukjinKwon commented on a change in pull request #33214:
URL: https://github.com/apache/spark/pull/33214#discussion_r663757786



##########
File path: python/pyspark/sql/types.py
##########
@@ -1020,10 +1020,19 @@ def _infer_type(obj):
         return dataType()
 
     if isinstance(obj, dict):
-        for key, value in obj.items():
-            if key is not None and value is not None:
-                return MapType(_infer_type(key), _infer_type(value), True)
-        return MapType(NullType(), NullType(), True)
+        from pyspark.sql.session import SparkSession
+        if (SparkSession._activeSession.conf.get(
+                "spark.sql.pyspark.inferNestedStructByMap").lower() == "true"):

Review comment:
       Can you pass a bool argument to `_infer_type` (and `_infer_schema`), and 
access to the configuration value like 
https://github.com/apache/spark/blob/master/python/pyspark/sql/pandas/conversion.py#L79?




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