ly164608001 opened a new issue #13001:
URL: https://github.com/apache/shardingsphere/issues/13001


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   5.0.0-alpha
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   the SQL listed below should be parsed correctly
   ### Actual behavior
   throw org.antlr.v4.runtime.NoViableAltException: null
   ### Reason analyze (If you can)
   It seems union all in subquery is not supported in mysql.
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   use pagehelper , the count sql is  : SELECTcount(0)
           from (
                    SELECT id
                    FROM table1
                    UNION ALL 
                    SELECT id
                    FROM table2
                ) t;
   line 1:406 no viable alternative at input 
'SELECTcount(0)FROM(SELECTidFROtable1UNION'
   org.antlr.v4.runtime.NoViableAltException: null
        at 
org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2026)
 ~[antlr4-runtime-4.7.2.jar:4.7.2]
        at 
org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467)
 ~[antlr4-runtime-4.7.2.jar:4.7.2]
        at 
org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393)
 ~[antlr4-runtime-4.7.2.jar:4.7.2]
   ### Example codes for reproduce this issue (such as a github link).
   
   public class ShardingTests {
       @Test
       void testSql() {
           String sql = "        select count(0)\n" +
                   "        from (\n" +
                   "                 SELECT id\n" +
                   "                 FROM table1\n" +
                   "                 UNION ALL\n" +
                   "                 SELECT id\n" +
                   "                 FROM table2\n" +
                   "             ) t\n";
   
           StandardSQLParserEngine standardSQLParserEngine = new 
StandardSQLParserEngine("Mysql");
           standardSQLParserEngine.parse(sql, true);
       }


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