iffyio commented on code in PR #1472: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1472#discussion_r1825428680
########## src/parser/mod.rs: ########## @@ -2799,12 +2806,33 @@ impl<'a> Parser<'a> { data_type: self.parse_data_type()?, format: None, }) - } else if Token::ExclamationMark == tok { - // PostgreSQL factorial operation + } else if Token::ExclamationMark == tok && self.dialect.supports_factorial_operator() { Ok(Expr::UnaryOp { op: UnaryOperator::PGPostfixFactorial, expr: Box::new(expr), }) + } else if Token::ExclamationMark == tok && self.dialect.supports_bang_not_operator() { + let token = self.next_token(); + match token.token { + Token::Word(_) | Token::Number(..) + if !matches!( + expr, + Expr::Value(_) + | Expr::Identifier(_) + | Expr::Nested(_) + | Expr::BinaryOp { .. } + ) => + { + Ok(Expr::UnaryOp { + op: UnaryOperator::BangNot, + expr: Box::new(expr), + }) + } + _ => parser_err!( + "current dialect support bang not operator, but with wrong syntax", + tok.location + ), Review Comment: Oh @wugeer do we need to push local changes to the MR?, this part of the code still looks unchanged? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org