From 82523eb4baef7d0e313a4c65c86f31ea96190555 Mon Sep 17 00:00:00 2001 From: Prajwal Kumar K Date: Mon, 5 Oct 2026 02:49:54 +0530 Subject: [PATCH] docs: explain dialect requirement for lambda examples --- datafusion/functions-nested/src/array_any_match.rs | 2 +- datafusion/functions-nested/src/array_filter.rs | 2 +- datafusion/functions-nested/src/array_first.rs | 2 +- datafusion/functions-nested/src/array_transform.rs | 2 +- docs/source/user-guide/sql/scalar_functions.md | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/datafusion/functions-nested/src/array_any_match.rs b/datafusion/functions-nested/src/array_any_match.rs index 97029eb422058..da2542253d301 100644 --- a/datafusion/functions-nested/src/array_any_match.rs +++ b/datafusion/functions-nested/src/array_any_match.rs @@ -45,7 +45,7 @@ make_higher_order_function_expr_and_func!( #[user_doc( doc_section(label = "Array Functions"), - description = "Returns whether any elements of an array match the given predicate. Returns true if one or more elements match, false if none match (including empty arrays), and null if the predicate returns null for some elements and false for all others.", + description = "Returns whether any elements of an array match the given predicate. Returns true if one or more elements match, false if none match (including empty arrays), and null if the predicate returns null for some elements and false for all others. Lambda expressions require a dialect that supports them; set `datafusion.sql_parser.dialect` to `DuckDB` because the default dialect does not parse the `->` syntax.", syntax_example = "any_match(array, predicate)", sql_example = r#"```sql > select any_match([1, 2, 3], x -> x > 2); diff --git a/datafusion/functions-nested/src/array_filter.rs b/datafusion/functions-nested/src/array_filter.rs index 9d59faaa0c6f9..426f9140e470a 100644 --- a/datafusion/functions-nested/src/array_filter.rs +++ b/datafusion/functions-nested/src/array_filter.rs @@ -52,7 +52,7 @@ make_higher_order_function_expr_and_func!( #[user_doc( doc_section(label = "Array Functions"), - description = "filters the values of an array using a boolean lambda", + description = "filters the values of an array using a boolean lambda. Lambda expressions require a dialect that supports them; set `datafusion.sql_parser.dialect` to `DuckDB` because the default dialect does not parse the `->` syntax.", syntax_example = "array_filter(array, x -> x > 2)", sql_example = r#"```sql > select array_filter([1, 2, 3, 4, 5], x -> x > 2); diff --git a/datafusion/functions-nested/src/array_first.rs b/datafusion/functions-nested/src/array_first.rs index 615dc47394379..b5a3713f37db8 100644 --- a/datafusion/functions-nested/src/array_first.rs +++ b/datafusion/functions-nested/src/array_first.rs @@ -46,7 +46,7 @@ make_higher_order_function_expr_and_func!( #[user_doc( doc_section(label = "Array Functions"), - description = "Returns the first element of an array that satisfies the given predicate. Returns null if the array is empty or no element matches. A predicate that returns null for an element is treated as not matching.", + description = "Returns the first element of an array that satisfies the given predicate. Returns null if the array is empty or no element matches. A predicate that returns null for an element is treated as not matching. Lambda expressions require a dialect that supports them; set `datafusion.sql_parser.dialect` to `DuckDB` because the default dialect does not parse the `->` syntax.", syntax_example = "array_first(array, predicate)", sql_example = r#"```sql > select array_first([1, 2, 3, 4], x -> x > 2); diff --git a/datafusion/functions-nested/src/array_transform.rs b/datafusion/functions-nested/src/array_transform.rs index ecf8620f4f7c1..aea3fb33af569 100644 --- a/datafusion/functions-nested/src/array_transform.rs +++ b/datafusion/functions-nested/src/array_transform.rs @@ -49,7 +49,7 @@ make_higher_order_function_expr_and_func!( #[user_doc( doc_section(label = "Array Functions"), - description = "transforms the values of an array", + description = "transforms the values of an array. Lambda expressions require a dialect that supports them; set `datafusion.sql_parser.dialect` to `DuckDB` because the default dialect does not parse the `->` syntax.", syntax_example = "array_transform(array, lambda)", sql_example = r#"```sql > select array_transform([1, 2, 3, 4, 5], x -> x*2); diff --git a/docs/source/user-guide/sql/scalar_functions.md b/docs/source/user-guide/sql/scalar_functions.md index 1ba1e8c820005..a96085958cc18 100644 --- a/docs/source/user-guide/sql/scalar_functions.md +++ b/docs/source/user-guide/sql/scalar_functions.md @@ -3411,7 +3411,7 @@ array_add(array1, array2) ### `array_any_match` -Returns whether any elements of an array match the given predicate. Returns true if one or more elements match, false if none match (including empty arrays), and null if the predicate returns null for some elements and false for all others. +Returns whether any elements of an array match the given predicate. Returns true if one or more elements match, false if none match (including empty arrays), and null if the predicate returns null for some elements and false for all others. Lambda expressions require a dialect that supports them; set `datafusion.sql_parser.dialect` to `DuckDB` because the default dialect does not parse the `->` syntax. ```sql any_match(array, predicate) @@ -3743,7 +3743,7 @@ _Alias of [array_element](#array_element)._ ### `array_filter` -filters the values of an array using a boolean lambda +filters the values of an array using a boolean lambda. Lambda expressions require a dialect that supports them; set `datafusion.sql_parser.dialect` to `DuckDB` because the default dialect does not parse the `->` syntax. ```sql array_filter(array, x -> x > 2) @@ -3771,7 +3771,7 @@ array_filter(array, x -> x > 2) ### `array_first` -Returns the first element of an array that satisfies the given predicate. Returns null if the array is empty or no element matches. A predicate that returns null for an element is treated as not matching. +Returns the first element of an array that satisfies the given predicate. Returns null if the array is empty or no element matches. A predicate that returns null for an element is treated as not matching. Lambda expressions require a dialect that supports them; set `datafusion.sql_parser.dialect` to `DuckDB` because the default dialect does not parse the `->` syntax. ```sql array_first(array, predicate) @@ -4707,7 +4707,7 @@ array_to_string(array, delimiter[, null_string]) ### `array_transform` -transforms the values of an array +transforms the values of an array. Lambda expressions require a dialect that supports them; set `datafusion.sql_parser.dialect` to `DuckDB` because the default dialect does not parse the `->` syntax. ```sql array_transform(array, lambda)