-
Couldn't load subscription status.
- Fork 1k
fix(optimizer)!: simplify AND/OR with static BOOLEAN type #6152
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
base: main
Are you sure you want to change the base?
Conversation
|
Discussed offline– we should check whether all engines evaluate connectors into boolean values, instead of treating them as control flow. If |
25beb8c to
306b884
Compare
306b884 to
66ffdd7
Compare
|
We discovered that post-simplifying we lose some types. That is a bug and we decided to address it in this PR instead of postponing, because that will reduce the PR's complexity as a side-effect. |
|
@barakalon @tobymao curious what your thoughts are on this. The problem: today we infer types & then run other rules that transform the AST, resulting in building new, untyped, expressions. This is a bug on its own, and it also affects type-sensitive rules. E.g., My worry is that fixing each call site introduces a new pattern where we have to be alert for rules after |
Fixes #6137
We should avoid simplifying cases like
SELECT 1 AND xorSELECT 0 or x.So, this PR makes this check tighter by checking if the LHS or RHS is
Booleantype.