ryanschneider commented on issue #1920: URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1920#issuecomment-3028305601
I did a bit more stepping through and I think I see the issue, it's in `get_next_precedence_default`, specifically in the `Keyword::NOT` arm: ``` Token::Word(w) if w.keyword == Keyword::NOT => match parser.peek_nth_token(1).token { // The precedence of NOT varies depending on keyword that // follows it. If it is followed by IN, BETWEEN, or LIKE, // it takes on the precedence of those tokens. Otherwise, it // is not an infix operator, and therefore has zero // precedence. Token::Word(w) if w.keyword == Keyword::IN => Ok(p!(Between)), Token::Word(w) if w.keyword == Keyword::BETWEEN => Ok(p!(Between)), Token::Word(w) if w.keyword == Keyword::LIKE => Ok(p!(Like)), Token::Word(w) if w.keyword == Keyword::ILIKE => Ok(p!(Like)), Token::Word(w) if w.keyword == Keyword::RLIKE => Ok(p!(Like)), Token::Word(w) if w.keyword == Keyword::REGEXP => Ok(p!(Like)), Token::Word(w) if w.keyword == Keyword::MATCH => Ok(p!(Like)), Token::Word(w) if w.keyword == Keyword::SIMILAR => Ok(p!(Like)), _ => Ok(self.prec_unknown()), }, ``` I think this is missing a case for `Keyword::NULL` but I need to do some more research to confirm that. To confirm, I see that `x IS NULL` parses ok: ```sql WITH t AS (SELECT NULL AS x) SELECT COUNT(CASE WHEN x IS NULL THEN 0 ELSE 1 END) AS x FROM t ``` So I need to see if `x NOT NULL` is a duckdb-ism or a more generally accepted expression. -- 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