You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "DeviousCardi (via GitHub)" <gi...@apache.org> on 2026/09/21 03:26:19 UTC

[PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

DeviousCardi opened a new pull request, #25561:
URL: https://github.com/apache/datafusion/pull/25561

   ## Which issue does this PR close?
   
   - Closes #25477.
   
   ## Rationale for this change
   
   `coalesce` is rewritten by `simplify` into `CASE WHEN a IS NOT NULL THEN a ELSE b END`, which names every argument but the last one twice. For a volatile argument those two mentions are two independent draws, so the null test and the returned value disagree:
   
   ```sql
   -- both draws are independent, so COALESCE can return NULL,
   -- which a single evaluation can never produce
   SELECT count(*), count(c) FROM (SELECT coalesce(nullif(floor(random() * 2), 0), neg) AS c FROM w);
   +--------+----------+
   | 100000 | 75117    |
   +--------+----------+
   ```
   
   24,883 NULLs, which is exactly `P(draw1 != 0) * P(draw2 == 0) = 0.5 * 0.5`. With a non-null literal as the last argument the planner marks the output non-nullable and it fails outright:
   
   ```
   Arrow error: Invalid argument error: Column 'c' is declared as non-nullable but contains null values
   ```
   
   `nvl` delegates to `CoalesceFunc`, so it has the same bug.
   
   ## What changes are included in this PR?
   
   `simplify` now returns the expression unchanged when any of `args[..n-1]` is volatile, and `invoke_with_args` gets its runtime kernel back — the one removed in e5dcc8c04 (#17357), which evaluates each argument exactly once. Only the non-final arguments are guarded, since the last one becomes the `ELSE` and is named once.
   
   This is deliberately smaller than the `BetweenExpr` approach in #25476: no new physical expression, no protobuf, no public API change. `coalesce` already has the right place to evaluate once — `invoke_with_args` — it was just stubbed out with an `internal_err!`.
   
   `nvl2` is unaffected and needs no guard: its `simplify` names `test`, `if_non_null` and `if_null` exactly once each.
   
   ## What is the testing strategy for this PR?
   
   11 unit tests in `coalesce.rs` covering the kernel and the guard, plus volatile cases in `coalesce.slt` for both `coalesce` and `nvl` — a `count(c) = count(*)` assertion that is exact rather than probabilistic, and `EXPLAIN` assertions pinning that the volatile shape stays `coalesce(...)` instead of expanding to `CASE`.
   
   Reverting only the source changes and keeping the tests fails 8 of 11 unit tests and 5 `coalesce.slt` assertions, including the plan diff showing `random()` named twice.
   
   ## Are there any user-facing changes?
   
   Yes, and there is a behaviour change beyond the bug fix worth calling out.
   
   A volatile `coalesce`/`nvl` is now **eager**, so a later argument that would previously have been skipped is evaluated:
   
   ```sql
   -- previously returned rows; now raises `Divide by zero error`
   SELECT coalesce(random(), y / x) FROM t;
   ```
   
   Only calls with a volatile argument before the last are affected; a volatile *last* argument keeps the lazy rewrite, and non-volatile `coalesce`/`nvl` is unchanged. Note that for a non-nullable volatile argument the old answer was already correct, so there the eagerness is a regression without a correctness gain — it is the price of evaluating the argument once.
   
   `nvl`'s documentation previously said the second argument "is not evaluated", which this makes false; that description is corrected and `scalar_functions.md` regenerated via `dev/update_function_docs.sh`. A 56.0.0 upgrade-guide entry is included, modelled on 54.0.0's evaluation-order section, pointing at `CASE` as the workaround.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#discussion_r4366822535


##########
datafusion/functions/src/core/coalesce.rs:
##########
@@ -29,7 +32,7 @@ use itertools::Itertools;
 
 #[user_doc(
     doc_section(label = "Conditional Functions"),
-    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.",
+    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.",

Review Comment:
   this seems like an unecessary level of detail for user documentation -- it follows from the definition of volatile functions I think



##########
datafusion/functions/src/core/coalesce.rs:
##########
@@ -146,3 +223,211 @@ impl ScalarUDFImpl for CoalesceFunc {
         self.doc()
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use std::sync::Arc;
+
+    use arrow::array::{Array, ArrayRef, Int32Array, StringArray};
+    use arrow::datatypes::DataType;
+    use datafusion_common::ScalarValue;
+    use datafusion_common::config::ConfigOptions;
+    use datafusion_expr::{ColumnarValue, Expr, ScalarUDFImpl, lit};
+
+    use super::*;
+
+    fn invoke(args: Vec<ColumnarValue>, number_rows: usize) -> ColumnarValue {

Review Comment:
   Can we please use slt tests here? The rust tests are pretty verbose and I think slt would offer better coverage?



##########
datafusion/functions/src/core/coalesce.rs:
##########
@@ -117,8 +139,63 @@ impl ScalarUDFImpl for CoalesceFunc {
     }
 
     /// coalesce evaluates to the first value which is not NULL
-    fn invoke_with_args(&self, _args: ScalarFunctionArgs) -> Result<ColumnarValue> {
-        internal_err!("coalesce should have been simplified to case")
+    ///
+    /// This kernel is only reached when [`Self::simplify`] declined to rewrite the

Review Comment:
   I am worried that this path will almost never be invoked and it is quite a bit slower than the fast CASE implementation we already have. 



##########
datafusion/functions/src/core/coalesce.rs:
##########
@@ -117,8 +139,63 @@ impl ScalarUDFImpl for CoalesceFunc {
     }
 
     /// coalesce evaluates to the first value which is not NULL
-    fn invoke_with_args(&self, _args: ScalarFunctionArgs) -> Result<ColumnarValue> {
-        internal_err!("coalesce should have been simplified to case")
+    ///
+    /// This kernel is only reached when [`Self::simplify`] declined to rewrite the

Review Comment:
   What do you think about doing something with lambda expressions so we can evaluate once and then use the binding? for example, something like this?
   
   ```sql
   coalesce(v, b, c)
     -->  apply(v, x -> CASE WHEN x IS NOT NULL THEN x ELSE coalesce(b, c) END)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#issuecomment-6383583119

   marking as draft while feedback is addressed


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#discussion_r4366966322


##########
docs/source/library-user-guide/upgrading/56.0.0.md:
##########
@@ -1306,3 +1306,29 @@ without declaring one, use `FileScanConfigBuilder::with_preserve_order(true)`.
 Code that reads `FileScanConfig::preserve_order` to decide whether files may be
 reordered should call `FileScanConfig::preserves_file_order()` instead, which
 also accounts for the output ordering.
+
+### A volatile `coalesce` or `nvl` argument is now evaluated eagerly

Review Comment:
   this is a bug fix so I think a line in the release notes is fine -- it doesn't ned an upgrade gudie entry



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "kosiew (via GitHub)" <gi...@apache.org>.
kosiew commented on PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#issuecomment-6161054256

   @DeviousCardi 
   Can you resolve the merge conflicts?
   I would love to review this after.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "DeviousCardi (via GitHub)" <gi...@apache.org>.
DeviousCardi commented on code in PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#discussion_r4299243411


##########
datafusion/sqllogictest/test_files/coalesce.slt:
##########
@@ -458,3 +458,78 @@ world
 
 statement ok
 drop table ree_t;
+
+##########
+# Volatile arguments must be evaluated exactly once
+# https://github.com/apache/datafusion/issues/25477
+##########
+
+# `coalesce` on a volatile argument must NOT be rewritten to
+# `CASE WHEN a IS NOT NULL THEN a ELSE b END`, because that names `a` twice and
+# therefore draws it twice. It must stay a `coalesce` call so the runtime kernel
+# evaluates each argument exactly once.
+query TT
+explain select coalesce(nullif(floor(random() * 2), 0), -1) as c;
+----
+logical_plan
+01)Projection: coalesce(nullif(floor(random() * Float64(2)), Float64(0)), Float64(-1)) AS c
+02)--EmptyRelation: rows=1
+physical_plan
+01)ProjectionExec: expr=[coalesce(nullif(floor(random() * 2), 0), -1) as c]
+02)--PlaceholderRowExec
+
+statement ok
+create table volatile_t as select * from generate_series(1, 100000) as t(i);
+
+# The fallback `-1` makes the result non-nullable, and with a single evaluation
+# per row the result really never is null: every row is either the non-null
+# volatile draw or the literal. Before the fix this both produced ~25% spurious
+# NULLs and tripped the non-nullable assertion in Arrow.
+query II
+select count(*), count(coalesce(nullif(floor(random() * 2), 0), -1))
+from volatile_t;
+----
+100000 100000
+
+# Every produced value must come from one of the two operands.
+query I
+select count(*)
+from (
+  select coalesce(nullif(floor(random() * 2), 0), -1) as c from volatile_t
+)
+where c not in (1, -1);
+----
+0
+
+# `nvl` delegates to `coalesce`, so it inherits the fix.
+query TT
+explain select nvl(nullif(floor(random() * 2), 0), -1) as c;
+----
+logical_plan
+01)Projection: nvl(nullif(floor(random() * Float64(2)), Float64(0)), Float64(-1)) AS c
+02)--EmptyRelation: rows=1
+physical_plan
+01)ProjectionExec: expr=[nvl(nullif(floor(random() * 2), 0), -1) as c]
+02)--PlaceholderRowExec
+
+query II
+select count(*), count(nvl(nullif(floor(random() * 2), 0), -1))
+from volatile_t;
+----
+100000 100000
+
+statement ok
+drop table volatile_t;
+
+# Non-volatile `coalesce` keeps the lazy CASE rewrite (see also
+# select.slt, which asserts `coalesce(1, y/x)` never divides by zero).
+query TT

Review Comment:
   Added in b924da14e. The SQL regression uses non-null `a` with `x = 0` and checks that `coalesce(a, y / x + random())` returns `a` without dividing by zero. An EXPLAIN assertion also checks that the volatile final argument keeps the CASE rewrite.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "kosiew (via GitHub)" <gi...@apache.org>.
kosiew commented on code in PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#discussion_r4280464805


##########
datafusion/sqllogictest/test_files/coalesce.slt:
##########
@@ -458,3 +458,78 @@ world
 
 statement ok
 drop table ree_t;
+
+##########
+# Volatile arguments must be evaluated exactly once
+# https://github.com/apache/datafusion/issues/25477
+##########
+
+# `coalesce` on a volatile argument must NOT be rewritten to
+# `CASE WHEN a IS NOT NULL THEN a ELSE b END`, because that names `a` twice and
+# therefore draws it twice. It must stay a `coalesce` call so the runtime kernel
+# evaluates each argument exactly once.
+query TT
+explain select coalesce(nullif(floor(random() * 2), 0), -1) as c;
+----
+logical_plan
+01)Projection: coalesce(nullif(floor(random() * Float64(2)), Float64(0)), Float64(-1)) AS c
+02)--EmptyRelation: rows=1
+physical_plan
+01)ProjectionExec: expr=[coalesce(nullif(floor(random() * 2), 0), -1) as c]
+02)--PlaceholderRowExec
+
+statement ok
+create table volatile_t as select * from generate_series(1, 100000) as t(i);
+
+# The fallback `-1` makes the result non-nullable, and with a single evaluation
+# per row the result really never is null: every row is either the non-null
+# volatile draw or the literal. Before the fix this both produced ~25% spurious
+# NULLs and tripped the non-nullable assertion in Arrow.
+query II
+select count(*), count(coalesce(nullif(floor(random() * 2), 0), -1))
+from volatile_t;
+----
+100000 100000
+
+# Every produced value must come from one of the two operands.
+query I
+select count(*)
+from (
+  select coalesce(nullif(floor(random() * 2), 0), -1) as c from volatile_t
+)
+where c not in (1, -1);
+----
+0
+
+# `nvl` delegates to `coalesce`, so it inherits the fix.
+query TT
+explain select nvl(nullif(floor(random() * 2), 0), -1) as c;
+----
+logical_plan
+01)Projection: nvl(nullif(floor(random() * Float64(2)), Float64(0)), Float64(-1)) AS c
+02)--EmptyRelation: rows=1
+physical_plan
+01)ProjectionExec: expr=[nvl(nullif(floor(random() * 2), 0), -1) as c]
+02)--PlaceholderRowExec
+
+query II
+select count(*), count(nvl(nullif(floor(random() * 2), 0), -1))
+from volatile_t;
+----
+100000 100000
+
+statement ok
+drop table volatile_t;
+
+# Non-volatile `coalesce` keeps the lazy CASE rewrite (see also
+# select.slt, which asserts `coalesce(1, y/x)` never divides by zero).
+query TT

Review Comment:
   Could we add a SQL regression test for a volatile final argument, such as `coalesce(a, y / x + random())` with non-null `a` and `x = 0`? It should return `a` without a divide-by-zero error, confirming that the CASE rewrite preserves lazy evaluation at runtime. This is optional since the existing tests already cover the reported bug.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "DeviousCardi (via GitHub)" <gi...@apache.org>.
DeviousCardi commented on PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#issuecomment-6375961525

   Rebased onto current main and resolved the 56.0.0 upgrade-guide conflict, preserving the upstream sections and the coalesce/nvl note. The updated branch is at 146a3eb95. Local checks passed: cargo fmt --all -- --check, cargo clippy --all-targets --all-features -- -D warnings, and the documentation Prettier check. CI is running on the new head.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "adriangb (via GitHub)" <gi...@apache.org>.
adriangb merged PR #25561:
URL: https://github.com/apache/datafusion/pull/25561


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "DeviousCardi (via GitHub)" <gi...@apache.org>.
DeviousCardi commented on code in PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#discussion_r4369737388


##########
datafusion/functions/src/core/coalesce.rs:
##########
@@ -29,7 +32,7 @@ use itertools::Itertools;
 
 #[user_doc(
     doc_section(label = "Conditional Functions"),
-    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.",
+    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.",

Review Comment:
   Agreed, removed in 3289dc434. The coalesce and nvl descriptions (and the generated scalar_functions.md) are back to their original text.



##########
datafusion/functions/src/core/coalesce.rs:
##########
@@ -146,3 +223,211 @@ impl ScalarUDFImpl for CoalesceFunc {
         self.doc()
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use std::sync::Arc;
+
+    use arrow::array::{Array, ArrayRef, Int32Array, StringArray};
+    use arrow::datatypes::DataType;
+    use datafusion_common::ScalarValue;
+    use datafusion_common::config::ConfigOptions;
+    use datafusion_expr::{ColumnarValue, Expr, ScalarUDFImpl, lit};
+
+    use super::*;
+
+    fn invoke(args: Vec<ColumnarValue>, number_rows: usize) -> ColumnarValue {

Review Comment:
   Done in 3289dc434. The Rust unit tests are gone and the coverage is now in coalesce.slt. To make the volatile path deterministic the tests use `case when random() >= 0 then x end`, which is volatile but always equals `x`, so they can check the kernel against exact expected rows (array args, a scalar fallback, all-null input, strings, and a volatile middle argument). The 100k-row `random()` query that reproduces the original bug is still there, now as a single query covering coalesce and nvl. With the volatility guard removed, three of the new queries fail.



##########
docs/source/library-user-guide/upgrading/56.0.0.md:
##########
@@ -1306,3 +1306,29 @@ without declaring one, use `FileScanConfigBuilder::with_preserve_order(true)`.
 Code that reads `FileScanConfig::preserve_order` to decide whether files may be
 reordered should call `FileScanConfig::preserves_file_order()` instead, which
 also accounts for the output ordering.
+
+### A volatile `coalesce` or `nvl` argument is now evaluated eagerly

Review Comment:
   Makes sense, removed in 3289dc434.



##########
datafusion/functions/src/core/coalesce.rs:
##########
@@ -117,8 +139,63 @@ impl ScalarUDFImpl for CoalesceFunc {
     }
 
     /// coalesce evaluates to the first value which is not NULL
-    fn invoke_with_args(&self, _args: ScalarFunctionArgs) -> Result<ColumnarValue> {
-        internal_err!("coalesce should have been simplified to case")
+    ///
+    /// This kernel is only reached when [`Self::simplify`] declined to rewrite the

Review Comment:
   Thanks, I looked into this. With the lambda support from #21679 the rewrite you describe can be expressed, and I think it is the better long-term shape. `v` would be evaluated once, `b` and `c` would stay lazy because the CASE inside the body only evaluates its ELSE on the remaining rows, and it would reuse the fast CASE implementation instead of a separate kernel.
   
   It is not a small change today, though:
   
   - There is no scalar `apply`/`let` higher-order function yet. All of the existing ones are list functions in functions-nested, and those are only registered when the `nested_expressions` feature is enabled. So we would need a new function in core that is always registered, either public or hidden.
   - Lambda variables are normally resolved by the SQL planner. `simplify` runs after that, so it would have to build an already-resolved `LambdaVariable` and the captures for `b` and `c` itself.
   - Substrait has no lambda support, so an optimized plan with a volatile coalesce would stop being serializable there. Proto deserialization would also need the function to be in the registry.
   
   In the meantime, 3289dc434 narrows the special case so the slow path covers as little as possible. The CASE rewrite now runs up to the first volatile non-final argument, and only the rest goes to the kernel: `coalesce(a, v, c)` becomes `CASE WHEN a IS NOT NULL THEN a ELSE coalesce(v, c) END`. Calls with no volatile non-final argument plan exactly as before and never reach the kernel. The kernel only runs when a volatile value has to be checked and returned, and in that case it is the only correct option we have right now.
   
   If you are OK with it, I would keep this narrow fix for the bug and open a follow-up issue for a general scalar binding function (`apply(v, x -> ...)`). Once that exists, this kernel could be replaced, and any other rewrite that duplicates an argument could use the same function.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "adriangb (via GitHub)" <gi...@apache.org>.
adriangb commented on PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#issuecomment-6462459441

   I took a look and this looks good to me. The reasoning in https://github.com/apache/datafusion/pull/25561#discussion_r4369738101 seems sound, I don't see an easier way to fix the bug without a big refactor. @alamb does that sound okay?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "DeviousCardi (via GitHub)" <gi...@apache.org>.
DeviousCardi commented on PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#issuecomment-6161546876

   @kosiew Thanks! I merged main and resolved the conflict. It was only in the 56.0.0 upgrade guide, where my note and new upstream sections landed in the same spot, so I kept both. Ready for review whenever you have time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "kosiew (via GitHub)" <gi...@apache.org>.
kosiew commented on PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#issuecomment-6283649457

   @DeviousCardi 
   Can you resolve the merge conflicts so I can merge this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#issuecomment-6186503120

   ## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/25561?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `91.90751%` with `14 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 82.85%. Comparing base ([`2c568b4`](https://app.codecov.io/gh/apache/datafusion/commit/2c568b478b3aff18de52609c7237f1c3f494d5b1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`ad08495`](https://app.codecov.io/gh/apache/datafusion/commit/ad08495c80f0f886bcc4557a7c580be45c965711?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 29 commits behind head on main.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/datafusion/pull/25561?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [datafusion/functions/src/core/coalesce.rs](https://app.codecov.io/gh/apache/datafusion/pull/25561?src=pr&el=tree&filepath=datafusion%2Ffunctions%2Fsrc%2Fcore%2Fcoalesce.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZGF0YWZ1c2lvbi9mdW5jdGlvbnMvc3JjL2NvcmUvY29hbGVzY2UucnM=) | 91.90% | [9 Missing and 5 partials :warning: ](https://app.codecov.io/gh/apache/datafusion/pull/25561?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##             main   #25561      +/-   ##
   ==========================================
   + Coverage   82.83%   82.85%   +0.01%     
   ==========================================
     Files        1149     1149              
     Lines      452798   453528     +730     
     Branches   452798   453528     +730     
   ==========================================
   + Hits       375082   375763     +681     
   - Misses      54893    54914      +21     
   - Partials    22823    22851      +28     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/25561?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: do not evaluate a volatile coalesce or nvl argument twice [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #25561:
URL: https://github.com/apache/datafusion/pull/25561#issuecomment-6504747544

   > I took a look and this looks good to me. The reasoning in [#25561 (comment)](https://github.com/apache/datafusion/pull/25561#discussion_r4369738101) seems sound, I don't see an easier way to fix the bug without a big refactor. @alamb does that sound okay?
   
   Yeah, sounds good to me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org