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 03:34:06 UTC
[GitHub] [spark] beliefer opened a new pull request, #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
beliefer opened a new pull request, #39422:
URL: https://github.com/apache/spark/pull/39422
### What changes were proposed in this pull request?
The connect's `Dataset.to()` lost some test cases.
This PR adds these test cases that refer https://github.com/apache/spark/blob/89666d44a39c48df841a0102ff6f54eaeb4c6140/python/pyspark/sql/tests/test_dataframe.py#L1464
### Why are the changes needed?
This PR adds these test cases for connect's `Dataset.to()`.
### Does this PR introduce _any_ user-facing change?
'No'.
New feature.
### How was this patch tested?
New test cases.
--
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
[GitHub] [spark] beliefer commented on a diff in pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
Posted by GitBox <gi...@apache.org>.
beliefer commented on code in PR #39422:
URL: https://github.com/apache/spark/pull/39422#discussion_r1063356072
##########
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:
`assert_eq_schema` looks is a better name.
--
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
[GitHub] [spark] beliefer commented on pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
Posted by GitBox <gi...@apache.org>.
beliefer commented on PR #39422:
URL: https://github.com/apache/spark/pull/39422#issuecomment-1374347281
@zhengruifeng @HyukjinKwon @amaliujia Thank you for all!
--
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
[GitHub] [spark] beliefer commented on pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
Posted by GitBox <gi...@apache.org>.
beliefer commented on PR #39422:
URL: https://github.com/apache/spark/pull/39422#issuecomment-1373385326
ping @zhengruifeng @HyukjinKwon
--
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
[GitHub] [spark] beliefer commented on a diff in pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
Posted by GitBox <gi...@apache.org>.
beliefer commented on code in PR #39422:
URL: https://github.com/apache/spark/pull/39422#discussion_r1063932365
##########
python/pyspark/sql/tests/connect/test_connect_basic.py:
##########
@@ -644,6 +645,15 @@ def test_schema(self):
def test_to(self):
# SPARK-41464: test DataFrame.to()
+ cdf = self.connect.read.table(self.tbl_name)
Review Comment:
`cdf` and `sdf` changed.
--
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
[GitHub] [spark] beliefer commented on a diff in pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
Posted by GitBox <gi...@apache.org>.
beliefer commented on code in PR #39422:
URL: https://github.com/apache/spark/pull/39422#discussion_r1063367461
##########
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:
OK
--
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
[GitHub] [spark] zhengruifeng commented on a diff in pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on code in PR #39422:
URL: https://github.com/apache/spark/pull/39422#discussion_r1063931078
##########
python/pyspark/sql/tests/connect/test_connect_basic.py:
##########
@@ -644,6 +645,15 @@ def test_schema(self):
def test_to(self):
# SPARK-41464: test DataFrame.to()
+ cdf = self.connect.read.table(self.tbl_name)
Review Comment:
what about simply:
```
cdf = ...
sdf = ...
for schema in [ schema1, schema2, schema3 ]:
cdf_to = cdf.to(schema)
sdf_to = sdf.to(schema)
self.assertEqual(cdf_to.schema, sdf_to.schema)
self.assert_eq(cdf_to.toPandas(), sdf_to.toPandas())
```
I prefer not adding extra comprasion function
--
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
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
Posted by GitBox <gi...@apache.org>.
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
[GitHub] [spark] zhengruifeng commented on a diff in pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on code in PR #39422:
URL: https://github.com/apache/spark/pull/39422#discussion_r1063934150
##########
python/pyspark/sql/tests/connect/test_connect_basic.py:
##########
@@ -644,6 +645,15 @@ def test_schema(self):
def test_to(self):
# SPARK-41464: test DataFrame.to()
+ cdf = self.connect.read.table(self.tbl_name)
Review Comment:
ok
--
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
[GitHub] [spark] zhengruifeng commented on pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on PR #39422:
URL: https://github.com/apache/spark/pull/39422#issuecomment-1374341098
merged into master, thanks @beliefer
--
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
[GitHub] [spark] zhengruifeng closed pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
Posted by GitBox <gi...@apache.org>.
zhengruifeng closed pull request #39422: [SPARK-41875][CONNECT][PYTHON] Add test cases for `Dataset.to()`
URL: https://github.com/apache/spark/pull/39422
--
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