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/06/04 03:20:24 UTC

[GitHub] [shardingsphere] jingshanglu commented on pull request #10381: Proofread Oracle `SELECT` subquery clause

jingshanglu commented on pull request #10381:
URL: https://github.com/apache/shardingsphere/pull/10381#issuecomment-854328765


   > @jingshanglu when testing `execute` rule for those specific `SELECT` statements, ANTLR plugin parses them successfully like earlier.
   > 
   > ![AntlrParseTree-OracleStatementG4](https://user-images.githubusercontent.com/48581379/119769050-5d731000-bed7-11eb-8cb8-0e99cc185525.png)
   > 
   > I tried to parse those specific `SELECT` statements via `execute` rule to ensure whether they parse correctly or not. I couldn't able to find any error. Am I testing them correctly?
   
   @ThanoshanMV @tristaZero  I tried it,The reason is that the `twoPhaseParse` function uses two `PredictionMode`, one is `SLL`, the other is `LL`, `SLL` is a kind of inaccurate `PredictionMode`, `LL` is no problem, So this print does not affect.
   ```
   private ParseASTNode twoPhaseParse(final String sql) {
           SQLParser sqlParser = SQLParserFactory.newInstance(databaseType, sql);
           try {
               setPredictionMode((Parser) sqlParser, PredictionMode.SLL);
               return (ParseASTNode) sqlParser.parse();
           } catch (final ParseCancellationException ex) {
               ((Parser) sqlParser).reset();
               setPredictionMode((Parser) sqlParser, PredictionMode.LL);
               try {
                   return (ParseASTNode) sqlParser.parse();
               } catch (final ParseCancellationException e) {
                   throw new SQLParsingException("You have an error in your SQL syntax");
               }
           }
       }
   ```


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