-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
This expression col < 10 and boolean(NULL) can either be NULL or false depending on the result of col < 10. Hence it should not be rewritten to a constant but it is current can.
To Reproduce
Add the following test in optimize_expr_bool_and, you will see it was rewritten to c1 BETWEEN Int32(0) AND Int32(10) which is wrong.
// c1 BETWEEN Int32(0) AND Int32(10) AND Boolean(NULL)
// it can be either NULL or false depending on the value of `c1 BETWEEN Int32(0) AND Int32(10`
let expr = Expr::Between{ expr: Box::new(col("c1")), negated: false, low: Box::new(lit(0)), high: Box::new(lit(10))};
let expr = expr.and(Expr::Literal(ScalarValue::Boolean(None)));
let result = expr.clone().rewrite(&mut rewriter)?;
println!("expr: {:#?} \n result: {:#?}", expr, result);
assert_eq!(expr, result);
Expected behavior
Do not rewritten expression that does not have deterministic result yet
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working