iffyio commented on code in PR #1472: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1472#discussion_r1817990993
########## src/parser/mod.rs: ########## @@ -1174,6 +1175,14 @@ impl<'a> Parser<'a> { ), }) } + Token::ExclamationMark if !self.dialect.supports_factorial_operator() => { Review Comment: Similarly, this comment looks unadressed? The new feature ideally has its own `dialect` method. Otherwise it can get complicated to try to infer when a feature should take precedence ########## tests/sqlparser_hive.rs: ########## @@ -537,6 +537,33 @@ fn parse_use() { ); } +#[test] +fn parse_hive_unary_ops() { Review Comment: The test comments are also unadressed? ########## src/parser/mod.rs: ########## @@ -2796,9 +2811,27 @@ impl<'a> Parser<'a> { format: None, }) } else if Token::ExclamationMark == tok { - // PostgreSQL factorial operation + match expr { + Expr::Value(_) | Expr::Identifier(_) => { + if !self.dialect.supports_factorial_operator() { + return parser_err!( + format!( + "current dialect: {:?} does not support factorial operator", + self.dialect + ), + self.peek_token().location + ); + } + } + _ => {} + }; + let op = if !self.dialect.supports_factorial_operator() { + UnaryOperator::SpecialNot + } else { + UnaryOperator::PGPostfixFactorial + }; Review Comment: I think this isn't fully implemented yet? we still have the match expr which we'd want to avoid ########## src/ast/operator.rs: ########## @@ -51,6 +51,8 @@ pub enum UnaryOperator { PGPrefixFactorial, /// Absolute value, e.g. `@ -9` (PostgreSQL-specific) PGAbs, + /// Special Not, e.g. `! false` (Hive-specific) + SpecialNot, Review Comment: This comment is unadressed? (in that the PR still uses 'special not') ########## src/parser/mod.rs: ########## @@ -1074,6 +1074,7 @@ impl<'a> Parser<'a> { })) } Keyword::NOT => self.parse_not(), + Review Comment: ```suggestion ``` -- 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