Skip to content

Remove error promotion from COALESCE #33103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions src/expr/src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1237,11 +1237,7 @@ impl MirScalarExpr {
let mut prior_exprs = BTreeSet::new();
exprs.retain(|e| prior_exprs.insert(e.clone()));

if let Some(expr) = exprs.iter_mut().find(|e| e.is_literal_err()) {
// One of the remaining arguments is an error, so
// just replace the entire coalesce with that error.
*e = expr.take();
} else if exprs.len() == 1 {
if exprs.len() == 1 {
// Only one argument, so the coalesce is a no-op.
*e = exprs[0].take();
}
Expand Down Expand Up @@ -3400,13 +3396,6 @@ mod tests {
},
output: lit(1),
},
TestCase {
input: MirScalarExpr::CallVariadic {
func: VariadicFunc::Coalesce,
exprs: vec![col(0), err(EvalError::DivisionByZero)],
},
output: err(EvalError::DivisionByZero),
},
TestCase {
input: MirScalarExpr::CallVariadic {
func: VariadicFunc::Coalesce,
Expand All @@ -3418,13 +3407,6 @@ mod tests {
},
output: err(EvalError::DivisionByZero),
},
TestCase {
input: MirScalarExpr::CallVariadic {
func: VariadicFunc::Coalesce,
exprs: vec![col(0), err(EvalError::DivisionByZero)],
},
output: err(EvalError::DivisionByZero),
},
];

for tc in test_cases {
Expand Down