[SPARK-59271][PYTHON][TESTS] Add tests for pandas.api.types is_* predicates - #58537
Open
Spenserrrr wants to merge 1 commit into
Open
[SPARK-59271][PYTHON][TESTS] Add tests for pandas.api.types is_* predicates#58537Spenserrrr wants to merge 1 commit into
Spenserrrr wants to merge 1 commit into
Conversation
…icates Add golden-file tests pinning the pandas type-introspection predicates (pandas.api.types.is_*) that PySpark branches on, in a new python/pyspark/tests/upstream/pandas package. Two classes split by input axis: the dtype predicates take a dtype or an array, the object predicates take an arbitrary object. The tests need no Spark session.
Spenserrrr
marked this pull request as ready for review
September 5, 2026 01:01
Contributor
Author
|
Hi @zhengruifeng @Yicong-Huang! This PR adds golden files for pandas.api.types.is_*. Could you take a look when you have time? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Add golden-file tests for the pandas type-introspection predicates (
pandas.api.types.is_*) that PySpark depends on, in a newpython/pyspark/tests/upstream/pandaspackage. Two classes split by input axis, matching how pandas itself implements them: the dtype predicates take a dtype or an array, the object predicates take an arbitrary object.Why are the changes needed?
PySpark branches on the boolean these predicates return, so an upstream change misroutes control flow instead of corrupting one value. For example
_create_from_pandas_with_arrowmaps a pandas column toTimestampTypeonly whenis_datetime64_dtypesays so, and that predicate answersFalsefor a tz-aware or arrow-backed timestamp dtype. Nothing currently pins those answers.Does this PR introduce any user-facing change?
No. Tests only.
How was this patch tested?
New tests, run across PyArrow 18-25 x pandas 2/3 (16/16 pass); the four cells that move on pandas 3 are recorded as version-guarded
overrides.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5)