Title: MySQL bitwise |, &, and shifts still share one parser precedence tier · Issue #2834 · JSQLParser/JSqlParser · GitHub
Open Graph Title: MySQL bitwise |, &, and shifts still share one parser precedence tier · Issue #2834 · JSQLParser/JSqlParser
X Title: MySQL bitwise |, &, and shifts still share one parser precedence tier · Issue #2834 · JSQLParser/JSqlParser
Description: Reproduction At current master commit f6ac2571e6e9777d6a5ee942a4ea53cd91153e4d, compile and run this with the built JAR on the classpath: import net.sf.jsqlparser.expression.BinaryExpression; import net.sf.jsqlparser.expression.Expressio...
Open Graph Description: Reproduction At current master commit f6ac2571e6e9777d6a5ee942a4ea53cd91153e4d, compile and run this with the built JAR on the classpath: import net.sf.jsqlparser.expression.BinaryExpression; impor...
X Description: Reproduction At current master commit f6ac2571e6e9777d6a5ee942a4ea53cd91153e4d, compile and run this with the built JAR on the classpath: import net.sf.jsqlparser.expression.BinaryExpression; impor...
Opengraph URL: https://github.com/JSQLParser/JSqlParser/issues/2834
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"MySQL bitwise |, &, and shifts still share one parser precedence tier","articleBody":"## Reproduction\n\nAt current `master` commit `f6ac2571e6e9777d6a5ee942a4ea53cd91153e4d`, compile and run this with the built JAR on the classpath:\n\n```java\nimport net.sf.jsqlparser.expression.BinaryExpression;\nimport net.sf.jsqlparser.expression.Expression;\nimport net.sf.jsqlparser.parser.AbstractJSqlParser.Dialect;\nimport net.sf.jsqlparser.parser.CCJSqlParserUtil;\nimport net.sf.jsqlparser.statement.select.Select;\npublic class Repro {\n static String shape(Expression e) {\n if (e instanceof BinaryExpression b)\n return \"(\" + shape(b.getLeftExpression()) + \" \" + e.getClass().getSimpleName()\n + \" \" + shape(b.getRightExpression()) + \")\";\n return e.toString();\n }\n public static void main(String[] args) throws Exception {\n for (String x : new String[]{\"1 | 2 & 4\", \"3 & 1 \u003c\u003c 2\"}) {\n Select s = (Select) CCJSqlParserUtil.parse(\"SELECT \" + x + \" AS x\",\n p -> p.withDialect(Dialect.MYSQL));\n System.out.println(x + \" => \" + shape(s.getPlainSelect().getSelectItem(0).getExpression()));\n }\n }\n}\n```\n\nObserved on 2026-10-19: `1 | 2 & 4` becomes `(1 | 2) & 4`, and `3 & 1 \u003c\u003c 2` becomes `(3 & 1) \u003c\u003c 2`. [MySQL's precedence table](https://dev.mysql.com/doc/refman/8.4/en/operator-precedence.html) requires `1 | (2 & 4)` and `3 & (1 \u003c\u003c 2)`. These paired groupings evaluate to `0` versus `1`, and `4` versus `0`, respectively.\n\nThe [arithmetic parser loop](https://github.com/JSQLParser/JSqlParser/blob/f6ac2571e6e9777d6a5ee942a4ea53cd91153e4d/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt#L748-L780) assigns precedence 4 to `|`, `&`, `\u003c\u003c`, and `>>` under the MySQL dialect. [PR #2833](https://github.com/JSQLParser/JSqlParser/pull/2833) corrected their tier relative to addition and explicitly notes that MySQL separates these bitwise operators. This issue tracks that remaining MySQL-specific grouping difference.\n","author":{"url":"https://github.com/pbottine","@type":"Person","name":"pbottine"},"datePublished":"2026-10-20T00:50:37Z","url":"https://github.com/JSQLParser/JSqlParser/issues/2834"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:05559b83-e801-7d7b-6421-cab6a13e6934 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A1D2:27DE6D:D08641:122EC2D:6B043DCE |
| html-safe-nonce | 439d8e99e06402d012ca311c4f8bc9970693aa8caac45092d780e5c736a0556e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMUQyOjI3REU2RDpEMDg2NDE6MTIyRUMyRDo2QjA0M0RDRSIsInZpc2l0b3JfaWQiOiIyNjUwNDg2Nzg2MTYxMzkzMTAyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fedf994515eb00790bfab85e70eb507eab7b493675a23df3cd86c40ebacb4175 |
| hovercard-subject-tag | issue:5933969578 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JSQLParser/JSqlParser/2834/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4612657526ecd9495f812afec7dc2780cc4112c985229de8abaa9d76d5aeec1e/JSQLParser/JSqlParser/issues/2834 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4612657526ecd9495f812afec7dc2780cc4112c985229de8abaa9d76d5aeec1e/JSQLParser/JSqlParser/issues/2834 |
| og:image:alt | Reproduction At current master commit f6ac2571e6e9777d6a5ee942a4ea53cd91153e4d, compile and run this with the built JAR on the classpath: import net.sf.jsqlparser.expression.BinaryExpression; impor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pbottine |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| turbo-cache-control | no-preview |
| go-import | github.com/JSQLParser/JSqlParser git https://github.com/JSQLParser/JSqlParser.git |
| octolytics-dimension-user_id | 4643847 |
| octolytics-dimension-user_login | JSQLParser |
| octolytics-dimension-repository_id | 1944709 |
| octolytics-dimension-repository_nwo | JSQLParser/JSqlParser |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1944709 |
| octolytics-dimension-repository_network_root_nwo | JSQLParser/JSqlParser |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width