HenryBui777 opened a new pull request, #56340: URL: https://github.com/apache/spark/pull/56340
### What changes were proposed in this pull request? In the Pandas API on Spark, arithmetic between a float Series and a `decimal.Decimal` scalar was inconsistent: - With ANSI mode ON: `TypeError` is raised correctly - - With ANSI mode OFF: Operation completes silently (incorrect) Native pandas always raises `TypeError` in this case. This PR fixes `FractionalOps` to always raise `TypeError` for decimal-float mixed arithmetic (`add`, `sub`) regardless of ANSI mode. ### Why are the changes needed? The behavior should always match native pandas, regardless of the Spark ANSI mode setting. Previously, `float_series + decimal.Decimal(1.5)` silently succeeded when ANSI mode was off. ### Does this PR introduce _any_ user-facing change? Yes. `float_series + decimal.Decimal(...)` and `float_series - decimal.Decimal(...)` now always raise `TypeError`, consistent with pandas. ### How was this patch tested? Added unit tests in: - `python/pyspark/pandas/tests/data_type_ops/test_decimal_float_arithmetic.py` ### Was this patch authored or co-authored using generative AI tooling? No. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
