Rainmemery commented on PR #40329:
URL: https://github.com/apache/shardingsphere/pull/40329#issuecomment-6339741961

   Thanks @terrymanu — the blocker is valid and I missed it. I checked whether 
any dialect *imports* the MySQL grammar and found none, which led me to 
conclude the change was isolated. That was the wrong test: Doris keeps its own 
copy of the shared `expr` rule, so it needed the same correction regardless of 
imports.
   
   Both required changes are in `979b648a`:
   
   **1. Doris grammar** — 
`parser/sql/engine/dialect/doris/.../doris/BaseRule.g4` L970-976 now reads `AND 
> XOR > OR`, matching MySQL. I confirmed the ordering against the official 
Doris table you linked (`AND, &&` = 9, `XOR` = 10, `OR` = 11), so both dialects 
now agree with their vendors.
   
   **2. Doris included in the regression case** — 
`select_where_with_expr_with_xor_or` in 
`sql/supported/dml/select-expression.xml` had `db-types="MySQL"`; it is now 
`db-types="MySQL,Doris"`. The expected AST in `case/dml/select-expression.xml` 
is shared (it carries no `db-types`), so no second copy was needed — the two 
dialects assert the same tree from the same SQL text.
   
   ### Verification
   
   Same ablation protocol as the MySQL change, run against Doris:
   
   | Step | `InternalDorisParserIT` |
   |---|---|
   | With the Doris grammar fix | **1415 tests, 0 failures, 0 errors** |
   | Doris grammar reverted, case left in place | **2 errors** (`[1111]`, 
`[1112]`) |
   | Fix restored | **1415 tests, 0 failures, 0 errors** |
   
   The two errors are the new case being consumed by Doris and disagreeing with 
the expected tree, which is what shows the case actually runs for Doris rather 
than silently skipping. Full sweep `Internal*ParserIT`: 11581 tests, 0 
failures, 0 errors.
   
   ### One adjacent finding, not changed
   
   While checking for other copies of this rule I found **Hive** 
(`hive/BaseRule.g4` L835-841) and **Presto** (`presto/BaseRule.g4` L840-846) 
carry the identical `AND > OR > XOR` ordering. I did **not** touch them:
   
   - I could not find an official precedence table listing `XOR` for either 
engine, so I have no source to justify the order — the justification that 
exists for MySQL and Doris does not carry over.
   - Unlike Doris they are not in scope here, and guessing would expand this 
PR's blast radius on weaker evidence.
   
   Happy to open a follow-up for Hive and Presto if you can confirm their 
intended precedence, or to fold them in here if you'd rather settle all four at 
once.
   


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

Reply via email to