Skip to content
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

Introduce Expr variants for IS [NOT] TRUE / FALSE / UNKNOWN #3268

Closed
andygrove opened this issue Aug 25, 2022 · 3 comments · Fixed by #3275
Closed

Introduce Expr variants for IS [NOT] TRUE / FALSE / UNKNOWN #3268

andygrove opened this issue Aug 25, 2022 · 3 comments · Fixed by #3275
Labels
enhancement New feature or request

Comments

@andygrove
Copy link
Member

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
In #3252 we added support for SQL IS [NOT] TRUE/FALSE by mapping to the existing logical binary operator Is[Not]DistinctFrom. This resulted in a small PR compared to introducing new Expr variants such as IsNotTrue, but the downside is that we are now unable to implement type validation/coercion to ensure that the left expression is a boolean value.

Describe the solution you'd like
Introduce new Expr variants but still map to the physical plan for IsDistinctFrom.

Describe alternatives you've considered
None

Additional context
None

@andygrove andygrove added the enhancement New feature or request label Aug 25, 2022
@andygrove
Copy link
Member Author

@sarahyurick fyi

@andygrove
Copy link
Member Author

andygrove commented Aug 25, 2022

Another option would be to add Operatror::IsTrue instead of a new Expr

Never mind, IS TRUE is a unary expression, not binary.

@liukun4515
Copy link
Contributor

Another option would be to add Operatror::IsTrue instead of a new Expr

Never mind, IS TRUE is a unary expression, not binary.

Hi @andygrove Do we need the other unary expression for IS_TRUE, IS_FALSE...
I go through preview pr for adding the sql syntax for above expr like that which convert the IS_TRUE to the binary expr

SQLExpr::IsNotTrue(expr) => Ok(Expr::BinaryExpr {
                left: Box::new(self.sql_expr_to_logical_expr(*expr, schema, ctes)?),
                op: Operator::IsDistinctFrom,
                right: Box::new(lit(true)),
            }),

I am not sure if it is a good way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants