You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "LucaCanali (via GitHub)" <gi...@apache.org> on 2024/04/16 14:32:08 UTC

Re: [PR] [SPARK-38098][PYTHON] Add support for ArrayType of nested StructType to arrow-based conversion [spark]

LucaCanali commented on code in PR #35391:
URL: https://github.com/apache/spark/pull/35391#discussion_r1567471077


##########
python/pyspark/sql/pandas/types.py:
##########
@@ -86,8 +86,15 @@ def to_arrow_type(dt: DataType) -> "pa.DataType":
     elif type(dt) == DayTimeIntervalType:
         arrow_type = pa.duration("us")
     elif type(dt) == ArrayType:
-        if type(dt.elementType) in [StructType, TimestampType]:
+        if type(dt.elementType) == TimestampType:
             raise TypeError("Unsupported type in conversion to Arrow: " + str(dt))
+        elif type(dt.elementType) == StructType:
+            if LooseVersion(pa.__version__) < LooseVersion("2.0.0"):
+                raise TypeError(
+                    "Array of StructType is only supported with pyarrow 2.0.0 and above"

Review Comment:
   Hi, @itholic thank you for reporting this.
   I have tried to reproduce the reported issue in my environment, but I get the expected result instead (I use Python 3.11, Spark 3.5.1, pyarrow 11). Can you please confirm that you still have this issue?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org