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/09/03 03:44:51 UTC

[GitHub] [shardingsphere] hujuncheng opened a new issue #7232: What's wrong with this SQL

hujuncheng opened a new issue #7232:
URL: https://github.com/apache/shardingsphere/issues/7232


   ## 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?
   
   org.apache.shardingsphere:sharding-jdbc-core:4.1.1
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   Normal execution
   
   ### Actual behavior
   
   throw a NullPointerException
   ``` Java
   line 1:291 no viable alternative at input 'systemconf0_.system'
   line 1:291 no viable alternative at input 'systemconf0_.system'
   line 1:398 no viable alternative at input 'systemconf0_.system'
   Exception in thread "main" java.lang.NullPointerException
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.createProjection(MySQLDMLVisitor.java:446)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitProjection(MySQLDMLVisitor.java:434)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitProjection(MySQLDMLVisitor.java:127)
   	at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$ProjectionContext.accept(MySQLStatementParser.java:5370)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitProjections(MySQLDMLVisitor.java:410)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitProjections(MySQLDMLVisitor.java:127)
   	at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$ProjectionsContext.accept(MySQLStatementParser.java:4865)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelectClause(MySQLDMLVisitor.java:329)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelectClause(MySQLDMLVisitor.java:127)
   	at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$SelectClauseContext.accept(MySQLStatementParser.java:4551)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitUnionClause(MySQLDMLVisitor.java:322)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitUnionClause(MySQLDMLVisitor.java:127)
   	at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$UnionClauseContext.accept(MySQLStatementParser.java:4446)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelect(MySQLDMLVisitor.java:314)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelect(MySQLDMLVisitor.java:127)
   	at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$SelectContext.accept(MySQLStatementParser.java:3098)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse0(SQLParserEngine.java:80)
   	at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse(SQLParserEngine.java:61)
   	at com.baidu.Test.main(Test.java:9)
   ```
   
   
   ### Reason analyze (If you can)
   
   The parser engine bug?
   Or not allow the column named 'system' ?  It works if i rename the colum.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   this table is not sharding
   ``` SQL
   select systemconf0_.id as id1_30_, systemconf0_.create_time as create_t2_30_, systemconf0_.creator as creator3_30_, systemconf0_.update_time as update_t4_30_, systemconf0_.updater as updater5_30_, systemconf0_.version as version6_30_, systemconf0_.config_name as config_n7_30_, systemconf0_.system as system8_30_, systemconf0_.value as value9_30_ from system_config systemconf0_ where systemconf0_.system="KA" and systemconf0_.config_name="test"
   ```
   
   ### Example codes for reproduce this issue (such as a github link).
   
   ``` Java
   public static void main(String[] args) {
           SQLParserEngine sqlParserEngine = new SQLParserEngine("MySQL");
           sqlParserEngine.parse("select systemconf0_.id as id1_30_, systemconf0_.create_time as create_t2_30_, "
                           + "systemconf0_.creator as creator3_30_, systemconf0_.update_time as update_t4_30_, "
                           + "systemconf0_.updater as updater5_30_, systemconf0_.version as version6_30_, systemconf0_"
                           + ".config_name as config_n7_30_, systemconf0_.system as system8_30_, systemconf0_.value as "
                           + "value9_30_ from system_config systemconf0_ where systemconf0_.system=\"KA\" and "
                           + "systemconf0_.config_name=\"test\""
                   , false);
       }
   ```
   


----------------------------------------------------------------
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] hujuncheng commented on issue #7232: What's wrong with this SQL

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


   I avoided this case by adding quote in sql. 
   The hibernate configuration item is `globally_quoted_identifiers: true`.
   FYI


----------------------------------------------------------------
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] tristaZero commented on issue #7232: What's wrong with this SQL

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


   @hujuncheng Thanks for your feedback, which gave one solution to the guys using 4.x release, I supposed. Besides, Please expect our next release including this bugfix. :-)


----------------------------------------------------------------
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] tristaZero commented on issue #7232: What's wrong with this SQL

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


   @hujuncheng Thanks for your feedback, which gave one solution to the guys using 4.x release, I supposed. Besides, Please expect our next release including this bugfix. :-)


----------------------------------------------------------------
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] tristaZero closed issue #7232: What's wrong with this SQL

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


   


----------------------------------------------------------------
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] tristaZero commented on issue #7232: What's wrong with this SQL

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


   @hujuncheng Hi
   
   I guess there is something wrong with our 4.x release. However, I tested your SQL on `the master branch`, and it worked well.
   You can have a try or wait for our next release. 
   
   Thanks,
   Trista


----------------------------------------------------------------
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] tristaZero edited a comment on issue #7232: What's wrong with this SQL

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


   @hujuncheng Hi
   
   Sorry for that, I guess there is something wrong with our 4.x release. However, I tested your SQL on `the master branch`, and it worked well.
   You can have a try or wait for our next release. 
   
   Thanks,
   Trista


----------------------------------------------------------------
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] tristaZero commented on issue #7232: What's wrong with this SQL

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






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