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/01/13 01:41:19 UTC

[GitHub] [shardingsphere] wgy8283335 opened a new issue #9005: Why we use “try catch” to implement the condition logic in the ShardingSphereSQLParserEngine.parse0() method?

wgy8283335 opened a new issue #9005:
URL: https://github.com/apache/shardingsphere/issues/9005


   ## Why we use try-catch to implement the condition judgment logic in the ShardingSphereSQLParserEngine.parse0() method?
    
   ```
       private SQLStatement parse0(final String sql, final boolean useCache) {
           try {
               return sqlStatementParserEngine.parse(sql, useCache);
           } catch (final SQLParsingException | ParseCancellationException originalEx) {
               try {
                   return distSQLStatementParserEngine.parse(sql);
               } catch (final SQLParsingException ignored) {
                   throw originalEx;
               }
           }
       }
   ```


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

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



[GitHub] [shardingsphere] wgy8283335 closed issue #9005: Why we use “try catch” to implement the condition logic in the ShardingSphereSQLParserEngine.parse0() method?

Posted by GitBox <gi...@apache.org>.
wgy8283335 closed issue #9005:
URL: https://github.com/apache/shardingsphere/issues/9005


   


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

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



[GitHub] [shardingsphere] tristaZero commented on issue #9005: Why we use “try catch” to implement the condition logic in the ShardingSphereSQLParserEngine.parse0() method?

Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #9005:
URL: https://github.com/apache/shardingsphere/issues/9005#issuecomment-759170005


   Hi, 
   `distSQLStatementParserEngine` and `sqlStatementParserEngine` have similar function though, server as different queries. Therefore, we have to firstly use  `sqlStatementParserEngine` and return the correct parsed result or continue use `distSQLStatementParserEngine` next if there is an exception from  `sqlStatementParserEngine`


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

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