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

   
   ### Which version of ShardingSphere did you use?
   5.2.1
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   
   SQL executed correctly
   
   ### Actual behavior
   
   java.lang.OutOfMemoryError
   
   ### Reason analyze (If you can)
   When parsing SQL, there is an endless loop!!
   
   
![image](https://user-images.githubusercontent.com/37607959/222663652-1f6b90c9-4cf4-41d7-a899-82c9900634a9.png)
   
   
       at 
org.apache.shardingsphere.sql.parser.sql.common.util.ExpressionExtractUtil.extractAndPredicates(java.util.Collection,
 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment)
 (line: 67)
       at 
org.apache.shardingsphere.sql.parser.sql.common.util.ExpressionExtractUtil.getAndPredicates(org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment)
 (line: 50)
       at 
org.apache.shardingsphere.sql.parser.sql.common.util.ExpressionExtractUtil.extractAndPredicates(java.util.Collection,
 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment)
 (line: 66)
       at 
org.apache.shardingsphere.sql.parser.sql.common.util.ExpressionExtractUtil.getAndPredicates(org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment)
 (line: 50)
       at 
org.apache.shardingsphere.sql.parser.sql.common.util.ColumnExtractor.extractColumnSegments(java.util.Collection,
 java.util.Collection) (line: 72)
       at 
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext.<init>(java.util.Map,
 java.util.List, 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement, 
java.lang.String) (line: 110)
       at 
org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(java.util.Map,
 java.util.List, 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DMLStatement, 
java.lang.String) (line: 163)
       at 
org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(java.util.Map,
 java.util.List, 
org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement, 
java.lang.String) (line: 146)
       at 
org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(java.util.Map,
 org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement, 
java.lang.String) (line: 131)
       at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection,
 java.lang.String, int, int, int, boolean, java.lang.String[ ]) (line: 196)
       at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection,
 java.lang.String) (line: 160)
       at 
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(java.lang.String)
 (line: 91)
       at 
org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(java.sql.Connection)
 (line: 86)
       at 
org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(java.sql.Connection,
 java.lang.Integer) (line: 88)
       at 
org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(java.sql.Connection,
 java.lang.Integer) (line: 59)
       at 
com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.prepareStatement(org.apache.ibatis.executor.statement.StatementHandler,
 org.apache.ibatis.logging.Log, boolean) (line: 94)
       at 
com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doQuery(org.apache.ibatis.mapping.MappedStatement,
 java.lang.Object, org.apache.ibatis.session.RowBounds, 
org.apache.ibatis.session.ResultHandler, org.apache.ibatis.mapping.BoundSql) 
(line: 68)
       at 
org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(org.apache.ibatis.mapping.MappedStatement,
 java.lang.Object, org.apache.ibatis.session.RowBounds, 
org.apache.ibatis.session.ResultHandler, org.apache.ibatis.cache.CacheKey, 
org.apache.ibatis.mapping.BoundSql) (line: 325)
       at 
org.apache.ibatis.executor.BaseExecutor.query(org.apache.ibatis.mapping.MappedStatement,
 java.lang.Object, org.apache.ibatis.session.RowBounds, 
org.apache.ibatis.session.ResultHandler, org.apache.ibatis.cache.CacheKey, 
org.apache.ibatis.mapping.BoundSql) (line: 156)
       at 
com.baomidou.mybatisplus.core.executor.MybatisCachingExecutor.query(org.apache.ibatis.mapping.MappedStatement,
 java.lang.Object, org.apache.ibatis.session.RowBounds, 
org.apache.ibatis.session.ResultHandler, org.apache.ibatis.cache.CacheKey, 
org.apache.ibatis.mapping.BoundSql) (line: 165)
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   SQL:
    
   select * from test where (id = 1 or id =2) and (id=3 or id =4 ) and (id=3 or 
id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 )  AND 
(id=3 or id =4 )  AND (id=3 or id =4 )   AND (id=3 or id =4 )   AND (id=3 or id 
=4 )   AND (id=3 or id =4 )  and (id=3 or id =4 ) and (id=3 or id =4 ) and 
(id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 )  AND (id=3 or id =4 
)  AND (id=3 or id =4 )   AND (id=3 or id =4 )   AND (id=3 or id =4 )   AND 
(id=3 or id =4 )  and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 
) and (id=3 or id =4 ) and (id=3 or id =4 )  AND (id=3 or id =4 )  AND (id=3 or 
id =4 )   AND (id=3 or id =4 )   AND (id=3 or id =4 )   AND (id=3 or id =4 ) 
and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id 
=4 ) and (id=3 or id =4 )  AND (id=3 or id =4 )  AND (id=3 or id =4 )   AND 
(id=3 or id =4 )   AND (id=3 or id =4 )   AND (id=3 or id =4 )  and (id=3 or id 
=4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or i
 d =4 ) and (id=3 or id =4 )  AND (id=3 or id =4 )  AND (id=3 or id =4 )   AND 
(id=3 or id =4 )   AND (id=3 or id =4 )   AND (id=3 or id =4 )  and (id=3 or id 
=4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 
or id =4 )  AND (id=3 or id =4 )  AND (id=3 or id =4 )   AND (id=3 or id =4 )   
AND (id=3 or id =4 )   AND (id=3 or id =4 ) 
   and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or 
id =4 ) and (id=3 or id =4 )  AND (id=3 or id =4 )  AND (id=3 or id =4 )   AND 
(id=3 or id =4 )   AND (id=3 or id =4 )   AND (id=3 or id =4 )  and (id=3 or id 
=4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 
or id =4 )  AND (id=3 or id =4 )  AND (id=3 or id =4 )   AND (id=3 or id =4 )   
AND (id=3 or id =4 )   AND (id=3 or id =4 )  and (id=3 or id =4 ) and (id=3 or 
id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 )  AND 
(id=3 or id =4 )  AND (id=3 or id =4 )   AND (id=3 or id =4 )   AND (id=3 or id 
=4 )   AND (id=3 or id =4 ) 
   
   
   
   


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