LucaCappelletti94 opened a new pull request, #2683:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2683

   SQLite puts `&`, `|`, `<<` and `>>` [on one precedence level with left 
associativity](https://www.sqlite.org/lang_expr.html#operators_and_parse_affecting_attributes).
 The shared precedence table ranks `&` above `|`, so the SQLite dialect parses 
`SELECT 6 | 1 & 3` as `6 | (1 & 3)`. SQLite evaluates it as `(6 | 1) & 3` and 
returns 3, while the parsed grouping evaluates to 7.
   
   This PR overrides `get_next_precedence` in the SQLite dialect for `&` and 
`|` only, mapping both to the existing `Ampersand` level. Other tokens and 
other dialects keep the default table. The test compares ASTs because both 
groupings print back to the same SQL, and it covers both operator orders, 
repeated operators, arithmetic, parentheses and comparisons.
   
   This is a prerequisite for #2657, which adds `<<` and `>>` to the same level.


-- 
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]

Reply via email to