[SPARK-56118][PS] Match pandas 3.0 bool handling in GroupBy.quantile#54929
Closed
ueshin wants to merge 2 commits intoapache:masterfrom
Closed
[SPARK-56118][PS] Match pandas 3.0 bool handling in GroupBy.quantile#54929ueshin wants to merge 2 commits intoapache:masterfrom
ueshin wants to merge 2 commits intoapache:masterfrom
Conversation
Member
Author
8f20c92 to
4b23626
Compare
4b23626 to
34b83e5
Compare
dongjoon-hyun
approved these changes
Mar 21, 2026
Member
|
Merged to master. |
terana
pushed a commit
to terana/spark
that referenced
this pull request
Mar 23, 2026
### What changes were proposed in this pull request?
This PR updates pandas API on Spark `GroupBy.quantile` to align its bool-dtype behavior with pandas 3.0.
Currently, `GroupBy.quantile` allows bool input and emits a `FutureWarning`. With this change, pandas API on Spark keeps that warning-based behavior when running against pandas versions earlier than 3.0, but raises `TypeError("Cannot use quantile with bool dtype")` when running with pandas 3.0 or later.
The related groupby quantile tests were also updated to cover both version-dependent paths:
- normal quantile behavior for numeric data
- warning-compatible behavior for bool data on pandas < 3.0
- `TypeError` for bool data on pandas >= 3.0
- existing invalid `q` input checks
### Why are the changes needed?
pandas 3.0 no longer allows `quantile` on bool dtype. pandas API on Spark should follow that behavior so groupby quantile results stay consistent with the pandas version it targets.
Without this change, pandas API on Spark would continue accepting bool input under pandas 3.0 and diverge from pandas behavior.
### Does this PR introduce _any_ user-facing change?
Yes, it will behave more like pandas 3.
### How was this patch tested?
Updated the related tests.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes apache#54929 from ueshin/issues/SPARK-56118/quantile.
Authored-by: Takuya Ueshin <ueshin@databricks.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
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?
This PR updates pandas API on Spark
GroupBy.quantileto align its bool-dtype behavior with pandas 3.0.Currently,
GroupBy.quantileallows bool input and emits aFutureWarning. With this change, pandas API on Spark keeps that warning-based behavior when running against pandas versions earlier than 3.0, but raisesTypeError("Cannot use quantile with bool dtype")when running with pandas 3.0 or later.The related groupby quantile tests were also updated to cover both version-dependent paths:
TypeErrorfor bool data on pandas >= 3.0qinput checksWhy are the changes needed?
pandas 3.0 no longer allows
quantileon bool dtype. pandas API on Spark should follow that behavior so groupby quantile results stay consistent with the pandas version it targets.Without this change, pandas API on Spark would continue accepting bool input under pandas 3.0 and diverge from pandas behavior.
Does this PR introduce any user-facing change?
Yes, it will behave more like pandas 3.
How was this patch tested?
Updated the related tests.
Was this patch authored or co-authored using generative AI tooling?
No.