mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-04 21:20:32 +00:00
add unknown, is not true/false/unknown (#583)
This commit is contained in:
parent
50aafa8dc1
commit
fc71719719
2 changed files with 20 additions and 0 deletions
|
@ -227,12 +227,20 @@ pub enum Expr {
|
||||||
CompositeAccess { expr: Box<Expr>, key: Ident },
|
CompositeAccess { expr: Box<Expr>, key: Ident },
|
||||||
/// `IS FALSE` operator
|
/// `IS FALSE` operator
|
||||||
IsFalse(Box<Expr>),
|
IsFalse(Box<Expr>),
|
||||||
|
/// `IS NOT FALSE` operator
|
||||||
|
IsNotFalse(Box<Expr>),
|
||||||
/// `IS TRUE` operator
|
/// `IS TRUE` operator
|
||||||
IsTrue(Box<Expr>),
|
IsTrue(Box<Expr>),
|
||||||
|
/// `IS NOT TRUE` operator
|
||||||
|
IsNotTrue(Box<Expr>),
|
||||||
/// `IS NULL` operator
|
/// `IS NULL` operator
|
||||||
IsNull(Box<Expr>),
|
IsNull(Box<Expr>),
|
||||||
/// `IS NOT NULL` operator
|
/// `IS NOT NULL` operator
|
||||||
IsNotNull(Box<Expr>),
|
IsNotNull(Box<Expr>),
|
||||||
|
/// `IS UNKNOWN` operator
|
||||||
|
IsUnknown(Box<Expr>),
|
||||||
|
/// `IS NOT UNKNOWN` operator
|
||||||
|
IsNotUnknown(Box<Expr>),
|
||||||
/// `IS DISTINCT FROM` operator
|
/// `IS DISTINCT FROM` operator
|
||||||
IsDistinctFrom(Box<Expr>, Box<Expr>),
|
IsDistinctFrom(Box<Expr>, Box<Expr>),
|
||||||
/// `IS NOT DISTINCT FROM` operator
|
/// `IS NOT DISTINCT FROM` operator
|
||||||
|
@ -412,9 +420,13 @@ impl fmt::Display for Expr {
|
||||||
}
|
}
|
||||||
Expr::CompoundIdentifier(s) => write!(f, "{}", display_separated(s, ".")),
|
Expr::CompoundIdentifier(s) => write!(f, "{}", display_separated(s, ".")),
|
||||||
Expr::IsTrue(ast) => write!(f, "{} IS TRUE", ast),
|
Expr::IsTrue(ast) => write!(f, "{} IS TRUE", ast),
|
||||||
|
Expr::IsNotTrue(ast) => write!(f, "{} IS NOT TRUE", ast),
|
||||||
Expr::IsFalse(ast) => write!(f, "{} IS FALSE", ast),
|
Expr::IsFalse(ast) => write!(f, "{} IS FALSE", ast),
|
||||||
|
Expr::IsNotFalse(ast) => write!(f, "{} IS NOT FALSE", ast),
|
||||||
Expr::IsNull(ast) => write!(f, "{} IS NULL", ast),
|
Expr::IsNull(ast) => write!(f, "{} IS NULL", ast),
|
||||||
Expr::IsNotNull(ast) => write!(f, "{} IS NOT NULL", ast),
|
Expr::IsNotNull(ast) => write!(f, "{} IS NOT NULL", ast),
|
||||||
|
Expr::IsUnknown(ast) => write!(f, "{} IS UNKNOWN", ast),
|
||||||
|
Expr::IsNotUnknown(ast) => write!(f, "{} IS NOT UNKNOWN", ast),
|
||||||
Expr::InList {
|
Expr::InList {
|
||||||
expr,
|
expr,
|
||||||
list,
|
list,
|
||||||
|
|
|
@ -1255,8 +1255,16 @@ impl<'a> Parser<'a> {
|
||||||
Ok(Expr::IsNotNull(Box::new(expr)))
|
Ok(Expr::IsNotNull(Box::new(expr)))
|
||||||
} else if self.parse_keywords(&[Keyword::TRUE]) {
|
} else if self.parse_keywords(&[Keyword::TRUE]) {
|
||||||
Ok(Expr::IsTrue(Box::new(expr)))
|
Ok(Expr::IsTrue(Box::new(expr)))
|
||||||
|
} else if self.parse_keywords(&[Keyword::NOT, Keyword::TRUE]) {
|
||||||
|
Ok(Expr::IsNotTrue(Box::new(expr)))
|
||||||
} else if self.parse_keywords(&[Keyword::FALSE]) {
|
} else if self.parse_keywords(&[Keyword::FALSE]) {
|
||||||
Ok(Expr::IsFalse(Box::new(expr)))
|
Ok(Expr::IsFalse(Box::new(expr)))
|
||||||
|
} else if self.parse_keywords(&[Keyword::NOT, Keyword::FALSE]) {
|
||||||
|
Ok(Expr::IsNotFalse(Box::new(expr)))
|
||||||
|
} else if self.parse_keywords(&[Keyword::UNKNOWN]) {
|
||||||
|
Ok(Expr::IsUnknown(Box::new(expr)))
|
||||||
|
} else if self.parse_keywords(&[Keyword::NOT, Keyword::UNKNOWN]) {
|
||||||
|
Ok(Expr::IsNotUnknown(Box::new(expr)))
|
||||||
} else if self.parse_keywords(&[Keyword::DISTINCT, Keyword::FROM]) {
|
} else if self.parse_keywords(&[Keyword::DISTINCT, Keyword::FROM]) {
|
||||||
let expr2 = self.parse_expr()?;
|
let expr2 = self.parse_expr()?;
|
||||||
Ok(Expr::IsDistinctFrom(Box::new(expr), Box::new(expr2)))
|
Ok(Expr::IsDistinctFrom(Box::new(expr), Box::new(expr2)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue