stat0s2p opened a new issue #8909:
URL: https://github.com/apache/shardingsphere/issues/8909


   ## 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-Proxy
   
   ### Expected behavior
   
   a sql submit to proxy which datagrip refresh databaes meta
   ```sql
   /* ApplicationName=DataGrip 2020.2.3 */ select database(), schema(), 
left(user(),instr(concat(user(),'@'),'@')-1), @@version_comment
   ```
   
   I execute the sql direct in datasource mysql,it look ok.
   
   ### Actual behavior
   
   proxy cant parse the sql and print an error in console:
   ```log
   line 1:59 no viable alternative at input 'selectdatabase(),schema'
   line 1:59 no viable alternative at input 'selectdatabase(),schema'
   [ERROR] 15:11:56.303 [pool-8-thread-1] o.a.s.p.f.c.CommandExecutorTask - 
Exception occur: 
   org.antlr.v4.runtime.misc.ParseCancellationException: null
        at 
org.antlr.v4.runtime.BailErrorStrategy.recover(BailErrorStrategy.java:51)
        at 
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.select(MySQLStatementParser.java:3631)
        at 
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.execute(MySQLStatementParser.java:936)
        at 
org.apache.shardingsphere.sql.parser.mysql.parser.MySQLParser.parse(MySQLParser.java:37)
        at 
org.apache.shardingsphere.sql.parser.core.parser.SQLParserExecutor.twoPhaseParse(SQLParserExecutor.java:84)
        at 
org.apache.shardingsphere.sql.parser.core.parser.SQLParserExecutor.parse(SQLParserExecutor.java:59)
        at 
org.apache.shardingsphere.sql.parser.core.parser.SQLParserExecutor.parse(SQLParserExecutor.java:53)
        at 
org.apache.shardingsphere.sql.parser.api.SQLParserEngine.parse(SQLParserEngine.java:46)
        at 
org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngine.parse(SQLStatementParserEngine.java:65)
        at 
org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngine.parse(SQLStatementParserEngine.java:53)
        at 
org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse0(ShardingSphereSQLParserEngine.java:74)
        at 
org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse(ShardingSphereSQLParserEngine.java:60)
        at 
org.apache.shardingsphere.proxy.backend.text.TextProtocolBackendHandlerFactory.newInstance(TextProtocolBackendHandlerFactory.java:63)
        at 
org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.<init>(MySQLComQueryPacketExecutor.java:54)
        at 
org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecutorFactory.newInstance(MySQLCommandExecutorFactory.java:70)
        at 
org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecuteEngine.getCommandExecutor(MySQLCommandExecuteEngine.java:60)
        at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:99)
        at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
        at java.base/java.lang.Thread.run(Thread.java:832)
   Caused by: org.antlr.v4.runtime.NoViableAltException: null
        at 
org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2026)
        at 
org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467)
        at 
org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393)
        at 
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.select(MySQLStatementParser.java:3594)
        ... 19 common frames omitted
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   1. add a simple mysql datasource
   2. start proxy server and connect port`3307` in datagrip
   3. refresh database meta
   4. or direct execute the sql:```sql
   /* ApplicationName=DataGrip 2020.2.3 */ select database(), schema(), 
left(user(),instr(concat(user(),'@'),'@')-1), @@version_comment
   ```
   ### Example codes for reproduce this issue (such as a github link).
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to