Skip to content

Conversation

@Yikun
Copy link
Member

@Yikun Yikun commented Jan 13, 2022

What changes were proposed in this pull request?

Use ComparisonTestBase as base class instead of PandasOnSparkTestCase with self.psdf in pandas test

class ComparisonTestBase(PandasOnSparkTestCase):
@property
def psdf(self):
return ps.from_pandas(self.pdf)
@property
def pdf(self):
return self.psdf.to_pandas()

Why are the changes needed?

We have many testcase are using same logic to covert pdf to psdf, we can use ComparisonTestBase as base class to reduce redundant.

Does this PR introduce any user-facing change?

NO, test only

How was this patch tested?

UT passed.

@Yikun Yikun marked this pull request as ready for review January 14, 2022 01:43
@Yikun
Copy link
Member Author

Yikun commented Jan 14, 2022

FYI @xinrong-databricks @HyukjinKwon

@HyukjinKwon HyukjinKwon changed the title [SPARK-37886][PySpark][TEST] Use ComparisonTestBase in pandas test [SPARK-37886][PYTHON][TESTS] Use ComparisonTestBase in pandas test Jan 14, 2022
@Yikun
Copy link
Member Author

Yikun commented Jan 14, 2022

FYI #35203, the Ops related tests have some refactors, so I also make it in a separated PR to help easy review.

@HyukjinKwon
Copy link
Member

👌

@HyukjinKwon
Copy link
Member

Merged to master.

dchvn pushed a commit to dchvn/spark that referenced this pull request Jan 19, 2022
### What changes were proposed in this pull request?
Use `ComparisonTestBase` as base class instead of `PandasOnSparkTestCase` with self.psdf in pandas test

https://github.com/apache/spark/blob/a70006d9a7b578721d152d0f89d1a894de38c25d/python/pyspark/testing/pandasutils.py#L265-L272

### Why are the changes needed?
We have many testcase are using same logic to covert `pdf` to `psdf`, we can use ComparisonTestBase as base class to reduce redundant.

### Does this PR introduce _any_ user-facing change?
NO, test only

### How was this patch tested?
UT passed.

Closes apache#35183 from Yikun/SPARK-37886.

Authored-by: Yikun Jiang <yikunkero@gmail.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants