You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2023/01/06 09:43:54 UTC
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
HyukjinKwon commented on code in PR #39422:
URL: https://github.com/apache/spark/pull/39422#discussion_r1063282548
##########
python/pyspark/sql/tests/connect/test_connect_basic.py:
##########
@@ -644,6 +644,15 @@ def test_schema(self):
def test_to(self):
# SPARK-41464: test DataFrame.to()
+ cdf = self.connect.read.table(self.tbl_name)
+ df = self.spark.read.table(self.tbl_name)
+
+ def compare_to_schema():
Review Comment:
Can we explicitly pass `df` so we know what is being compared? I would also name it like `assert_eq_schema`
##########
python/pyspark/sql/tests/connect/test_connect_basic.py:
##########
@@ -652,11 +661,17 @@ def test_to(self):
]
)
- cdf = self.connect.read.table(self.tbl_name).to(schema)
- df = self.spark.read.table(self.tbl_name).to(schema)
+ compare_to_schema()
+
+ # Change schema with struct
+ schema2 = StructType([StructField("struct", schema, False)])
+ from pyspark.sql import functions as SF
+ from pyspark.sql.connect import functions as CF
Review Comment:
Let's import them on the top
--
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