Repository navigation
Commit a635b18
authored
docs: fix signum documentation to say zero returns 0 (apache#24324)
## Which issue does this PR close?
N/A — documentation-only correction; no open issue tracks it.
## Rationale for this change
The user guide for `signum` says "Zero and positive numbers return `1`",
but
`signum(0)` returns `0` — the documented return value for zero is the
opposite
of 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 1`
- The unit tests in `signum.rs` assert `signum(±0.0) == 0.0`
That behavior is intentional: it matches PostgreSQL `sign()` and Spark
`signum()`, and was changed on purpose in apache#11580 (issue apache#11557). Only
the docs
were left describing the pre-apache#11580 behavior, so this PR updates the
docs, not
the code.
## What changes are included in this PR?
Documentation only:
- Update the `#[user_doc]` description in
`datafusion/functions/src/math/signum.rs`
to state that zero returns `0`.
- Regenerate `docs/source/user-guide/sql/scalar_functions.md` via
`dev/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 passed
- `cargo fmt --all -- --check` and `./ci/scripts/doc_prettier_check.sh`
→ clean
## Are 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.
Co-authored-by: codeAnqiang-ma <[email protected]>1 parent 6b7da9a commit a635b18
2 files changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
799 | | - | |
| 799 | + | |
| 800 | + | |
800 | 801 | | |
801 | 802 | | |
802 | 803 | | |
| |||
0 commit comments