You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/08/25 07:03:18 UTC

[GitHub] [shardingsphere] strongduanmu commented on pull request #11996: optimize and or condition parse and extract logic

strongduanmu commented on pull request #11996:
URL: https://github.com/apache/shardingsphere/pull/11996#issuecomment-905238344


   In different database dialects, the `and` operator has a higher priority than the `or` operator, so it should be parsed according to the priority when parsing.
   
   However, the parsing engine does not distinguish the priority of `and` and `or`, which results in incorrect parsing results of the following sentences, and ultimately leads to extremely complicated logic for extracting `AndPredicate` when using the parsing results.
   
   ```sql
   SELECT * FROM t_order WHERE a = 1 AND b = 2 OR c = 3 AND d = 4 OR e = 5 AND f = 6;
   ```
   
   Current parse result:
   
   ![image](https://user-images.githubusercontent.com/10829171/130741904-16d5c1aa-1274-49c0-8896-a2b89fb29b34.png)
   
   Optimized parse result:
   
   ![image](https://user-images.githubusercontent.com/10829171/130741963-4ef1e4db-5e22-4b39-8a1b-71c099903029.png)
   
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org