Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
SPARK-25213: Fix PySpark test.
  • Loading branch information
rdblue committed Aug 23, 2018
commit 550368eaeebdc87f2c89bad7214f2624784eeb04
2 changes: 1 addition & 1 deletion python/pyspark/sql/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6399,7 +6399,7 @@ def test_pyspark_udf_SPARK_25213(self):
from pyspark.sql.functions import udf

df = self.spark.read.format("org.apache.spark.sql.sources.v2.SimpleDataSourceV2").load()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this test will fail if test classes are not compiled. Can we check if test classes are compiled and then skip if not existent?

result = datasource_v2_df.withColumn('x', udf(lambda x: x, 'int')(datasource_v2_df['i']))
result = df.withColumn('x', udf(lambda x: x, 'int')(df['i']))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only tests Project with Scalar PythonUDF? Might be better to also test Filter case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I was just verifying that the fix worked before spending more time on it.

rows = list(map(lambda r: r.asDict(), result.collect()))
expected = [{'i': i, 'j': -i, 'x': i} for i in range(10)]
self.assertEqual(rows, expected)
Expand Down