sadhen commented on a change in pull request #32026:
URL: https://github.com/apache/spark/pull/32026#discussion_r606036073



##########
File path: python/pyspark/sql/tests/test_arrow.py
##########
@@ -196,6 +197,33 @@ def test_pandas_round_trip(self):
         pdf_arrow = df.toPandas()
         assert_frame_equal(pdf_arrow, pdf)
 
+    def test_udt_roundtrip(self):
+        pdf = pd.DataFrame({'point': pd.Series([ExamplePoint(1.0, 1.0), 
ExamplePoint(2.0, 2.0)])})
+        schema = StructType([StructField('point', ExamplePointUDT(), False)])
+        with 
self.sql_conf({"spark.sql.execution.arrow.pyspark.fallback.enabled": True}):
+            df = self.spark.createDataFrame(pdf, schema)
+            pdf_arrow = df.toPandas()
+            assert_frame_equal(pdf_arrow, pdf)
+        with 
self.sql_conf({"spark.sql.execution.arrow.pyspark.fallback.enabled": False}):
+            df = self.spark.createDataFrame(pdf, schema)
+            pdf_arrow = df.toPandas()
+            assert_frame_equal(pdf_arrow, pdf)
+
+    def test_array_udt_roundtrip(self):
+        pdf = pd.DataFrame({'points': pd.Series([
+            [ExamplePoint(1.0, 1.0), ExamplePoint(1.0, 2.0), ExamplePoint(1.0, 
3.0)],

Review comment:
       See `_deserialize_pandas_with_udt`, support for StructType is postponed 
in later PRs. 




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

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



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

Reply via email to