sabir-akhadov-localstack commented on code in PR #2470:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2470#discussion_r4323747878
##########
src/parser/mod.rs:
##########
@@ -4154,6 +4154,31 @@ impl<'a> Parser<'a> {
self.parse_is_json_predicate(expr, false)
} else if self.parse_keywords(&[Keyword::NOT,
Keyword::JSON]) {
self.parse_is_json_predicate(expr, true)
+ } else if self.dialect.supports_is_operator() {
+ if let Some((form, negated)) =
+ self.maybe_parse(|parser|
parser.parse_unicode_is_normalized_suffix())?
+ {
+ Ok(Expr::IsNormalized {
+ expr: Box::new(expr),
+ form,
+ negated,
+ })
+ } else {
+ let op = if self.parse_keyword(Keyword::NOT) {
+ BinaryOperator::IsNot
+ } else {
+ BinaryOperator::Is
+ };
+ // SQLite parses `IS` at the same left-associative
level as the
+ // comparison operators, see
<https://www.sqlite.org/syntax/expr.html>
Review Comment:
SQLite puts `<` `<=` `>` `>=` one level above `=`/`IS` (lang_expr.html,
operator table), so `a IS b < c` is `a IS (b < c)` there while this yields `(a
IS b) < c`; sqlite 3.46: `SELECT 0 IS 1 < 2` -> 0. Same pre-existing lumping
the crate does for `a = b < c`, so fine to leave, but the comment could say
"same level as `=`" and link lang_expr.html rather than syntax/expr.html, which
has no precedence info.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]