iffyio commented on code in PR #1472: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1472#discussion_r1824600145
########## 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: ```suggestion ``` @wugeer I think one comment, rationale I [described here](https://github.com/apache/datafusion-sqlparser-rs/pull/1472#discussion_r1824158563) could you take a look? (realised it might have been missed since that thread was resolved) I suspect all that's need there would be to remove this block -- 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