Skip to content

Commit

Permalink
Revert not rewrite in binding
Browse files Browse the repository at this point in the history
  • Loading branch information
liurenjie1024 committed Mar 11, 2024
1 parent 0422f07 commit 665f47a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions crates/iceberg/src/expr/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,13 @@ impl Bind for Predicate {
})
}
Predicate::Not(expr) => {
let [inner] = expr.inputs;
inner.negate().bind(schema, case_sensitive)
let bound_expr = expr.bind(schema, case_sensitive)?;
let [inner] = bound_expr.inputs;
Ok(match inner {
e if matches!(&*e, &BoundPredicate::AlwaysTrue) => BoundPredicate::AlwaysFalse,
e if matches!(&*e, &BoundPredicate::AlwaysFalse) => BoundPredicate::AlwaysTrue,
e => BoundPredicate::Not(LogicalExpression::new([e])),
})
}
Predicate::Or(expr) => {
let bound_expr = expr.bind(schema, case_sensitive)?;
Expand Down Expand Up @@ -847,7 +852,7 @@ mod tests {
let schema = table_schema_simple();
let expr = !Reference::new("bar").less_than(Datum::int(10));
let bound_expr = expr.bind(schema, true).unwrap();
assert_eq!(&format!("{bound_expr}"), "bar >= 10");
assert_eq!(&format!("{bound_expr}"), "NOT (bar < 10)");
}

#[test]
Expand Down

0 comments on commit 665f47a

Please sign in to comment.