Skip to content

Commit 427fc30

Browse files
committed
Further simplification of is_null
1 parent 4af84a7 commit 427fc30

File tree

3 files changed

+273
-250
lines changed

3 files changed

+273
-250
lines changed

datafusion/expr/src/expr_schema.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -305,17 +305,15 @@ impl ExprSchemable for Expr {
305305
// For branches with a nullable 'then' expression, try to determine
306306
// if the 'then' expression is ever reachable in the situation where
307307
// it would evaluate to null.
308-
let is_null = |expr: &Expr /* Type */| {
309-
if expr.eq(t) {
310-
Some(true)
311-
} else {
312-
None
313-
}
308+
let bounds = match predicate_bounds::evaluate_bounds(
309+
w,
310+
Some(t),
311+
input_schema,
312+
) {
313+
Err(e) => return Some(Err(e)),
314+
Ok(b) => b,
314315
};
315316

316-
let bounds =
317-
predicate_bounds::evaluate_bounds(w, is_null, input_schema);
318-
319317
if bounds.is_certainly_not_true() {
320318
// The predicate will never evaluate to true, so the 'then' expression
321319
// is never reachable.

0 commit comments

Comments
 (0)