You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2024/06/27 06:59:39 UTC
(spark) branch master updated: [SPARK-48733][PYTHON][TESTS] Do not test SET command in Python UDTF test
This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new c788d1255aa0 [SPARK-48733][PYTHON][TESTS] Do not test SET command in Python UDTF test
c788d1255aa0 is described below
commit c788d1255aa0604a7ae3cd028803effc2b2adb0a
Author: Hyukjin Kwon <gu...@apache.org>
AuthorDate: Thu Jun 27 15:59:29 2024 +0900
[SPARK-48733][PYTHON][TESTS] Do not test SET command in Python UDTF test
### What changes were proposed in this pull request?
This PR avoid testing SET command in Python UDTF test
### Why are the changes needed?
To avoid duplicated test cases. SET command should have its own dedicated test.
### Does this PR introduce _any_ user-facing change?
No, test-only
### How was this patch tested?
CI in this PRs should verify them
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #47117 from HyukjinKwon/SPARK-48733.
Authored-by: Hyukjin Kwon <gu...@apache.org>
Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
python/pyspark/sql/tests/test_udtf.py | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/python/pyspark/sql/tests/test_udtf.py b/python/pyspark/sql/tests/test_udtf.py
index 1ff367f9731f..66f1a3090546 100644
--- a/python/pyspark/sql/tests/test_udtf.py
+++ b/python/pyspark/sql/tests/test_udtf.py
@@ -2559,16 +2559,18 @@ class UDTFArrowTestsMixin(BaseUDTFTestsMixin):
def eval(self):
yield 1,
- # We do not use `self.sql_conf` here to test the SQL SET command
- # instead of using PySpark's `spark.conf.set`.
old_value = self.spark.conf.get("spark.sql.execution.pythonUDTF.arrow.enabled")
- self.spark.sql("SET spark.sql.execution.pythonUDTF.arrow.enabled=False")
- self.assertEqual(udtf(TestUDTF, returnType="x: int").evalType, PythonEvalType.SQL_TABLE_UDF)
- self.spark.sql("SET spark.sql.execution.pythonUDTF.arrow.enabled=True")
- self.assertEqual(
- udtf(TestUDTF, returnType="x: int").evalType, PythonEvalType.SQL_ARROW_TABLE_UDF
- )
- self.spark.conf.set("spark.sql.execution.pythonUDTF.arrow.enabled", old_value)
+ try:
+ self.spark.conf.set("spark.sql.execution.pythonUDTF.arrow.enabled", False)
+ self.assertEqual(
+ udtf(TestUDTF, returnType="x: int").evalType, PythonEvalType.SQL_TABLE_UDF
+ )
+ self.spark.conf.set("spark.sql.execution.pythonUDTF.arrow.enabled", True)
+ self.assertEqual(
+ udtf(TestUDTF, returnType="x: int").evalType, PythonEvalType.SQL_ARROW_TABLE_UDF
+ )
+ finally:
+ self.spark.conf.set("spark.sql.execution.pythonUDTF.arrow.enabled", old_value)
def test_udtf_eval_returning_non_tuple(self):
@udtf(returnType="a: int")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org