[SPARK-55791][PYTHON] Fix pandas-on-Spark equality comparisons under ANSI mode#55987
Open
fuxi611 wants to merge 1 commit into
Open
[SPARK-55791][PYTHON] Fix pandas-on-Spark equality comparisons under ANSI mode#55987fuxi611 wants to merge 1 commit into
fuxi611 wants to merge 1 commit into
Conversation
…ison behavior Co-authored-by: Le Nguyen Gia Bao <22120023@student.hcmus.edu.vn>
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 fixes pandas-on-Spark equality and inequality comparisons between incompatible dtypes under ANSI mode.
The change makes pandas-on-Spark return pandas-compatible boolean results for incompatible dtype comparisons instead of delegating them to Spark SQL casting behavior:
eqreturns allFalsenereturns allTrueThis covers comparisons such as numeric Series/Index against string Series/Index or string scalar values.
Why are the changes needed?
ANSI mode should not change pandas API on Spark behavior. Without this fix, Spark SQL may try to cast incompatible operands under ANSI mode, which can produce behavior that differs from pandas or raise errors for comparisons where pandas would simply return boolean results.
Does this PR introduce any user-facing change?
Yes. pandas-on-Spark comparison behavior becomes more consistent with pandas under ANSI mode for incompatible dtype equality and inequality comparisons.
How was this patch tested?
Ran: