This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-25697-424cfd8eb7e5d73229227324f02b39179babeeb1 in repository https://gitbox.apache.org/repos/asf/datafusion.git
commit 9951f0b351b751d26b66085190ac969ecd53b34d Author: jackylee <[email protected]> AuthorDate: Thu Sep 24 09:33:06 2026 +0000 fix: document empty() as returning a boolean, not 1/0 (#25697) ## Which issue does this PR close? - N/A ## Rationale for this change `empty`'s docs say it "Returns 1 for an empty array or 0 for a non-empty array" and show `select empty([1])` returning `0`. But `empty` returns a boolean (`return_type` is `Boolean`); `array/array_empty.slt` shows `empty(make_array(1))` is `false`. Following the docs (`empty(...) = 1`) fails to plan with `Cannot infer common argument type Boolean = Int64`. ## What changes are included in this PR? Corrects the description and `sql_example` to return `false`, and regenerates `scalar_functions.md`. ## What is the testing strategy for this PR? Docs only; behaviour is unchanged and already covered by `array/array_empty.slt` (`empty(make_array(1))` → `false`). ## Are there any user-facing changes? The SQL reference for `empty` (and aliases `array_empty`/`list_empty`) is now correct. No API change. --- datafusion/functions-nested/src/empty.rs | 4 ++-- docs/source/user-guide/sql/scalar_functions.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/datafusion/functions-nested/src/empty.rs b/datafusion/functions-nested/src/empty.rs index 6db412d29b..855b793953 100644 --- a/datafusion/functions-nested/src/empty.rs +++ b/datafusion/functions-nested/src/empty.rs @@ -43,14 +43,14 @@ make_udf_expr_and_func!( #[user_doc( doc_section(label = "Array Functions"), - description = "Returns 1 for an empty array or 0 for a non-empty array.", + description = "Returns true for an empty array or false for a non-empty array.", syntax_example = "empty(array)", sql_example = r#"```sql > select empty([1]); +------------------+ | empty(List([1])) | +------------------+ -| 0 | +| false | +------------------+ ```"#, argument( diff --git a/docs/source/user-guide/sql/scalar_functions.md b/docs/source/user-guide/sql/scalar_functions.md index d1a9f37fc9..1ba1e8c820 100644 --- a/docs/source/user-guide/sql/scalar_functions.md +++ b/docs/source/user-guide/sql/scalar_functions.md @@ -4858,7 +4858,7 @@ _Alias of [inner_product](#inner_product)._ ### `empty` -Returns 1 for an empty array or 0 for a non-empty array. +Returns true for an empty array or false for a non-empty array. ```sql empty(array) @@ -4875,7 +4875,7 @@ empty(array) +------------------+ | empty(List([1])) | +------------------+ -| 0 | +| false | +------------------+ ``` --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
