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 2022/11/23 01:13:29 UTC
[GitHub] [spark] zhengruifeng commented on a diff in pull request #38723: [SPARK-41201][CONNECT][PYTHON] Implement `DataFrame.SelectExpr` in Python client
zhengruifeng commented on code in PR #38723:
URL: https://github.com/apache/spark/pull/38723#discussion_r1029949413
##########
python/pyspark/sql/tests/connect/test_connect_basic.py:
##########
@@ -302,6 +301,31 @@ def test_to_pandas(self):
self.spark.sql(query).toPandas(),
)
+ def test_select_expr(self):
+ # SPARK-41201: test selectExpr API.
+ self.assert_eq(
+ self.connect.read.table(self.tbl_name).selectExpr("id * 2").toPandas(),
+ self.spark.read.table(self.tbl_name).selectExpr("id * 2").toPandas(),
+ )
+ self.assert_eq(
+ self.connect.read.table(self.tbl_name)
+ .selectExpr(["id * 2", "cast(name as long) as name"])
+ .toPandas(),
+ self.spark.read.table(self.tbl_name)
+ .selectExpr(["id * 2", "cast(name as long) as name"])
+ .toPandas(),
+ )
+
+ self.assert_eq(
+ self.connect.read.table(self.tbl_name)
+ .selectExpr("id * 2", "cast(name as long) as name")
+ .toPandas(),
+ self.spark.read.table(self.tbl_name)
+ .selectExpr("id * 2", "cast(name as long) as name")
+ .toPandas(),
+ )
+
+ @unittest.skip("test_fill_na is flaky")
Review Comment:
@amaliujia why you disable this test again?
--
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