From 90d4e1325c982dca01605c50b847bbc49d1c2802 Mon Sep 17 00:00:00 2001 From: codeAnqiang-ma <273298913+codeAnqiang-ma@users.noreply.github.com> Date: Thu, 13 Aug 2026 19:59:37 +0800 Subject: [PATCH] docs: fix signum documentation to say zero returns 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 #11580 (issue #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) --- datafusion/functions/src/math/signum.rs | 3 ++- docs/source/user-guide/sql/scalar_functions.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/datafusion/functions/src/math/signum.rs b/datafusion/functions/src/math/signum.rs index 05b78fcffe2a7..21b38988c0a01 100644 --- a/datafusion/functions/src/math/signum.rs +++ b/datafusion/functions/src/math/signum.rs @@ -34,7 +34,8 @@ use datafusion_macros::user_doc; doc_section(label = "Math Functions"), description = r#"Returns the sign of a number. Negative numbers return `-1`. -Zero and positive numbers return `1`."#, +Zero returns `0`. +Positive numbers return `1`."#, syntax_example = "signum(numeric_expression)", standard_argument(name = "numeric_expression", prefix = "Numeric"), sql_example = r#"```sql diff --git a/docs/source/user-guide/sql/scalar_functions.md b/docs/source/user-guide/sql/scalar_functions.md index 1bfec4ce43599..644d42935ec29 100644 --- a/docs/source/user-guide/sql/scalar_functions.md +++ b/docs/source/user-guide/sql/scalar_functions.md @@ -796,7 +796,8 @@ round(numeric_expression[, decimal_places]) Returns the sign of a number. Negative numbers return `-1`. -Zero and positive numbers return `1`. +Zero returns `0`. +Positive numbers return `1`. ```sql signum(numeric_expression)