trycache0828 opened a new issue #10954:
URL: https://github.com/apache/shardingsphere/issues/10954


   ## Bug Report
   
   ![sharding-jdbc-4 1 
1-SQLUtil](https://user-images.githubusercontent.com/14318621/123197213-ca30f880-d4dd-11eb-97e2-1a263e8c04a5.png)
   
   ### Which version of ShardingSphere did you use?
   
   4.1.1
   
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
               <version>4.1.1</version>
           </dependency>
   
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-jdbc-core</artifactId>
               <version>4.1.1</version>
           </dependency>
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   Caused by: java.lang.StringIndexOutOfBoundsException: String index out of 
range: 0
        at java.lang.String.charAt(String.java:658)
        at 
org.apache.shardingsphere.sql.parser.sql.util.SQLUtil.getParenthesesOffset(SQLUtil.java:98)
        at 
org.apache.shardingsphere.sql.parser.sql.util.SQLUtil.getExpressionWithoutOutsideParentheses(SQLUtil.java:92)
        at 
org.apache.shardingsphere.sql.parser.sql.segment.dml.item.ExpressionProjectionSegment.<init>(ExpressionProjectionSegment.java:47)
        at 
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.createProjection(MySQLDMLVisitor.java:474)
        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)
   
   ### Actual behavior
   
   Normal resolution
   
   ### Reason analyze (If you can)
   
   Error caused by column name is '' of SQL query statement.As shown in the 
screenshot.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   This error in shardingsphere-sql-parser-statement-4.1.1.jar.
   
   This class in org.apache.shardingsphere.sql.parser.sql.util.SQLUtil, the 
method is getParenthesesOffset.
   
   This special case needs to be addressed
   
   ### Example codes for reproduce this issue (such as a github link).
   
   NONE
   


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