daiqiang opened a new issue, #34039:
URL: https://github.com/apache/shardingsphere/issues/34039

   ## Bug Report
   
   **For English only**, other languages will not accept.
           my sql parsing failure
   `select ti.user_name from my_user ti where user_name = 'xxx'`
           it throws a Execption:
   
`org.apache.shardingsphere.infra.exception.dialect.exception.syntax.sql.DialectSQLParsingException:
 You have an error in your SQL syntax: no viable alternative at input 'ti'
        at 
org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.getException(ShardingSphereSQLParserEngine.java:66)
        at 
org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse(ShardingSphereSQLParserEngine.java:59)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.parseSQL(ShardingSpherePreparedStatement.java:164)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:145)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:117)
        at 
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:141)
        at 
com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:337)
        at 
com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
        at 
org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:86)
        at 
org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88)
        at 
org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:59)
        at 
org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:87)
        at 
org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
        at 
org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
        at 
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
        at 
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)
        at com.sun.proxy.$Proxy70.selectOne(Unknown Source)
        at 
org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:160)
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:87)
        at 
org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145)
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
        at com.sun.proxy.$Proxy71.sql_s14(Unknown Source)`
   
   ### Which version of ShardingSphere did you use?
           shardingSphere-5.5.1
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
           ShardingSphere-JDBC
   ### Which DB
           oracle
   ### Expected behavior
          parse SQL sucess
   ### Actual behavior
           
`org.apache.shardingsphere.infra.exception.dialect.exception.syntax.sql.DialectSQLParsingException:
 You have an error in your SQL syntax: no viable alternative at input 'ti'`
   ### Reason analyze (If you can)
          I analyzed this bug , I fined the word "ti" is the keyword in 
"oralce/Keyword.g4",but I don't know how the Keyword.g4 file affects SQL 
parsing. In order for the SQL to be parsed correctly, I had to remove the 
keyword "ti" from the Keyword.g4 file.I have handled many such SQLs in the same 
way. until I discovered that this is not a good way.
         please somebody who can tell me, if don't remove keyword "ti" or don't 
modify my table's alias, what can I do to resovle this question?
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
         skip
   ### Example codes for reproduce this issue (such as a github link).
           `select ti.user_name from my_user ti where user_name = 'xxx'`


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