docs: fix signum documentation to say zero returns 0 - #24324
Merged
Jefffrey merged 1 commit intoAug 14, 2026
Conversation
The `#[user_doc]` description for `signum` said "Zero and positive numbers return `1`", but `signum(0)` returns `0`. The repository's own tests already assert this: scalar.slt checks `select signum(-2), signum(0), signum(2);` returns `-1 0 1`, and the signum unit tests assert `signum(±0.0) == 0.0`. That behavior is intentional and matches PostgreSQL `sign()` and Spark `signum()`; it was changed on purpose in apache#11580 (issue apache#11557). Only the documentation was left describing the old behavior, so this updates the description and regenerates docs/source/user-guide/sql/scalar_functions.md with dev/update_function_docs.sh. No behavior change. Assisted-by: Cursor (Opus 5)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24324 +/- ##
==========================================
- Coverage 81.14% 81.14% -0.01%
==========================================
Files 1112 1112
Lines 386933 386933
Branches 386933 386933
==========================================
- Hits 313967 313958 -9
- Misses 54476 54481 +5
- Partials 18490 18494 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Jefffrey
approved these changes
Aug 14, 2026
Jefffrey
left a comment
Contributor
There was a problem hiding this comment.
word of advice if there is a human looking at this; the PR description doesnt need to be that verbose for such a simple change. theres elegance in being succinct
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.
Which issue does this PR close?
N/A — documentation-only correction; no open issue tracks it.
Rationale for this change
The user guide for
signumsays "Zero and positive numbers return1", butsignum(0)returns0— the documented return value for zero is the oppositeof what the function does. The repository's own tests already pin the real
behavior:
datafusion/sqllogictest/test_files/scalar.slt:select signum(-2), signum(0), signum(2);→-1 0 1signum.rsassertsignum(±0.0) == 0.0That behavior is intentional: it matches PostgreSQL
sign()and Sparksignum(), and was changed on purpose in #11580 (issue #11557). Only the docswere left describing the pre-#11580 behavior, so this PR updates the docs, not
the code.
What changes are included in this PR?
Documentation only:
#[user_doc]description indatafusion/functions/src/math/signum.rsto state that zero returns
0.docs/source/user-guide/sql/scalar_functions.mdviadev/update_function_docs.sh.Are these changes tested?
No new tests: the corrected wording describes behavior the existing tests above
already assert, and those are what it was checked against.
cargo test -p datafusion-functions --lib math::signum→ 2 passedcargo fmt --all -- --checkand./ci/scripts/doc_prettier_check.sh→ cleanAre there any user-facing changes?
Yes, documentation only. No API or runtime behavior change.
Prepared with AI assistance; every claim above was verified locally against the
repository's existing tests before opening this PR.