You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document that a volatile coalesce or nvl argument is evaluated eagerly
`nvl`'s user documentation promised that the second argument "is not
evaluated". That stops being true once the volatility guard skips the
`CASE` rewrite, because `ScalarFunctionExpr::evaluate` evaluates every
child before calling `invoke_with_args`, and nothing in the physical layer
defers an argument. `coalesce` promised nothing either way, but the new
behaviour is worth stating there too.
`scalar_functions.md` is generated from these `#[user_doc]` attributes by
`dev/update_function_docs.sh`, and CI fails on drift, so the regenerated
file is included here.
Also adds a 56.0.0 upgrade-guide entry, as `api-health.md` asks for
user-visible SQL changes, modelled on 54.0.0's evaluation-order section
and pointing at the same `CASE` workaround.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: datafusion/functions/src/core/coalesce.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ use itertools::Itertools;
32
32
33
33
#[user_doc(
34
34
doc_section(label = "Conditional Functions"),
35
-
description = "Returns the first of its arguments that is not _null_. Returns _null_ if all arguments are _null_. This function is often used to substitute a default value for _null_ values.",
35
+
description = "Returns the first of its arguments that is not _null_. Returns _null_ if all arguments are _null_. Arguments after the first non-_null_ one are normally not evaluated, but when any argument other than the last is volatile every argument is evaluated, so that each is evaluated exactly once. This function is often used to substitute a default value for _null_ values.",
Copy file name to clipboardExpand all lines: datafusion/functions/src/core/nvl.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ use datafusion_macros::user_doc;
27
27
28
28
#[user_doc(
29
29
doc_section(label = "Conditional Functions"),
30
-
description = "Returns _expression2_ if _expression1_ is NULL otherwise it returns _expression1_ and _expression2_ is not evaluated. This function can be used to substitute a default value for NULL values.",
30
+
description = "Returns _expression2_ if _expression1_ is NULL otherwise it returns _expression1_. _expression2_ is normally not evaluated, but when _expression1_ is volatile both arguments are evaluated, so that _expression1_ is evaluated exactly once. This function can be used to substitute a default value for NULL values.",
Returns the first of its arguments that is not _null_. Returns _null_ if all arguments are _null_. This function is often used to substitute a default value for _null_ values.
965
+
Returns the first of its arguments that is not _null_. Returns _null_ if all arguments are _null_. Arguments after the first non-_null_ one are normally not evaluated, but when any argument other than the last is volatile every argument is evaluated, so that each is evaluated exactly once. This function is often used to substitute a default value for _null_ values.
Returns _expression2_ if _expression1_ is NULL otherwise it returns _expression1_ and _expression2_ is not evaluated. This function can be used to substitute a default value for NULL values.
1069
+
Returns _expression2_ if _expression1_ is NULL otherwise it returns _expression1_. _expression2_ is normally not evaluated, but when _expression1_ is volatile both arguments are evaluated, so that _expression1_ is evaluated exactly once. This function can be used to substitute a default value for NULL values.
0 commit comments