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 2020/11/07 07:45:41 UTC

[GitHub] [shardingsphere] chenrtoken opened a new issue #8065: if sql contains 'addtime' ,parse sql will throw NullPointException!

chenrtoken opened a new issue #8065:
URL: https://github.com/apache/shardingsphere/issues/8065


   Framework: 
           springboot:2.0.3.RELEASE
           mybatis-plus: 2.2.0
           mybatis: 3.4.6
           sharding-jdbc-spring-boot-starter: ,4.1.1
           
   SQLParserEngine#parse0   do parse 'select park_code , addtime from t_park_info limit 1' throw NullPointerException;
   
   console message:
   line 1:27 no viable alternative at input 'addtimefrom'
   line 1:27 no viable alternative at input 'addtimefrom'
   org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
   ### Error querying database.  Cause: java.lang.NullPointerException
   ### The error may exist in com/tnar/model/mapper/TParkInfoMapper.java (best guess)
   ### The error may involve defaultParameterMap
   ### The error occurred while setting parameters
   ### SQL: select park_code , addtime from t_park_info limit 1
   ### Cause: java.lang.NullPointerException
   
   ### Cause: java.lang.NullPointerException
   	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
   	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:433)
   	... 96 more
   Caused by: java.lang.NullPointerException
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.MySQLVisitor.visitPredicate(MySQLVisitor.java:316)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.MySQLVisitor.visitPredicate(MySQLVisitor.java:121)
   


----------------------------------------------------------------
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] strongduanmu edited a comment on issue #8065: if sql contains 'addtime' ,parse sql will throw NullPointException!

Posted by GitBox <gi...@apache.org>.
strongduanmu edited a comment on issue #8065:
URL: https://github.com/apache/shardingsphere/issues/8065#issuecomment-723419556


   @chenrtoken Hi, because `ADDTIME` is a keyword in MySQL. You can try this SQL——select park_code , \`addtime\` from t_park_info limit 1. You can also try the `5.0.0-alpha` version, which will be released soon. This exception is fixed in this version. 


----------------------------------------------------------------
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] chenrtoken commented on issue #8065: if sql contains 'addtime' ,parse sql will throw NullPointException!

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


   @strongduanmu  copy that , thanks.


----------------------------------------------------------------
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] strongduanmu commented on issue #8065: if sql contains 'addtime' ,parse sql will throw NullPointException!

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


   @chenrtoken Hi, because `ADDTIME` is a keyword in MySQL. You can try this SQL——select park_code , \`addtime\` from t_park_info limit 1.
   


----------------------------------------------------------------
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] strongduanmu closed issue #8065: if sql contains 'addtime' ,parse sql will throw NullPointException!

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


   


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