Skip to content

[SPARK-52570][PS] Enable divide-by-zero for numeric rmod with ANSI enabled #51275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

xinrong-meng
Copy link
Member

@xinrong-meng xinrong-meng commented Jun 24, 2025

What changes were proposed in this pull request?

Enable divide-by-zero for numeric rmod with ANSI enabled

Why are the changes needed?

Part of https://issues.apache.org/jira/browse/SPARK-52169.

Does this PR introduce any user-facing change?

Yes.

>>> ps.set_option("compute.fail_on_ansi_mode", False)
>>> ps.set_option("compute.ansi_mode_support", True)

>>> pdf = pd.DataFrame({"a": [0], "b": [False]})
>>> pdf.dtypes
a    int64
b     bool
dtype: object
>>> psdf = ps.from_pandas(pdf)
>>> 1 % psdf["a"]
0   NaN
Name: a, dtype: float64
>>> 1 % psdf["b"]
0   NaN
Name: b, dtype: float64

How was this patch tested?

Unit tests.

(dev3.11) spark (bool_mod_new) % SPARK_ANSI_SQL_MODE=true  ./python/run-tests --python-executables=python3.11 --testnames "pyspark.pandas.tests.data_type_ops.test_boolean_ops 
...
Tests passed in 4 seconds

Was this patch authored or co-authored using generative AI tooling?

No.

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.

3 participants