Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Do not test SET command in Python UDTF test
  • Loading branch information
HyukjinKwon committed Jun 27, 2024
commit 3626e8e2aef6a955ee9baa8f12884667c7fa72dc
20 changes: 11 additions & 9 deletions python/pyspark/sql/tests/test_udtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2559,16 +2559,18 @@ class TestUDTF:
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")
Expand Down