mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-19 13:40:15 +00:00
Add support in IS boolean filter (#474)
* Add support in IS TRUE IS FALSE * Fix lint * Add test for is false
This commit is contained in:
parent
525ba527bb
commit
7732c34b19
2 changed files with 35 additions and 1 deletions
|
@ -1130,9 +1130,21 @@ impl<'a> Parser<'a> {
|
|||
{
|
||||
let expr2 = self.parse_expr()?;
|
||||
Ok(Expr::IsNotDistinctFrom(Box::new(expr), Box::new(expr2)))
|
||||
} else if let Some(right) =
|
||||
self.parse_one_of_keywords(&[Keyword::TRUE, Keyword::FALSE])
|
||||
{
|
||||
let mut val = Value::Boolean(true);
|
||||
if right == Keyword::FALSE {
|
||||
val = Value::Boolean(false);
|
||||
}
|
||||
Ok(Expr::BinaryOp {
|
||||
left: Box::new(expr),
|
||||
op: BinaryOperator::Eq,
|
||||
right: Box::new(Expr::Value(val)),
|
||||
})
|
||||
} else {
|
||||
self.expected(
|
||||
"[NOT] NULL or [NOT] DISTINCT FROM after IS",
|
||||
"[NOT] NULL or [NOT] DISTINCT FROM TRUE FALSE after IS",
|
||||
self.peek_token(),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue