zcqshine opened a new issue #2137: batchSave IndexOutOfBoundsException
URL: https://github.com/apache/incubator-shardingsphere/issues/2137
 
 
   ## Bug Report
   version: `4.0.0-RC1-RELEASE` `4.0.0.RC1-SNAPSHOT`
   batchInsert will throwable IndexOutOfBoundsException: Index:0, Size 0
   
   err msg:
   ```
   at java.util.LinkedList.checkElementIndex(LinkedList.java:555)
        at java.util.LinkedList.get(LinkedList.java:476)
        at 
org.apache.shardingsphere.core.optimize.result.InsertColumnValues$InsertColumnValue.getColumnSQLExpressionValue(InsertColumnValues.java:154)
        at 
org.apache.shardingsphere.core.optimize.result.InsertColumnValues$InsertColumnValue.fillResultByValues(InsertColumnValues.java:148)
        at 
org.apache.shardingsphere.core.optimize.result.InsertColumnValues$InsertColumnValue.toString(InsertColumnValues.java:133)
        at java.lang.String.valueOf(String.java:2981)
        at java.lang.StringBuilder.append(StringBuilder.java:131)
        at 
org.apache.shardingsphere.core.rewrite.SQLBuilder.appendInsertColumnValue(SQLBuilder.java:197)
        at 
org.apache.shardingsphere.core.rewrite.SQLBuilder.appendInsertValuesPlaceholder(SQLBuilder.java:190)
        at 
org.apache.shardingsphere.core.rewrite.SQLBuilder.toSQL(SQLBuilder.java:115)
        at 
org.apache.shardingsphere.core.rewrite.SQLRewriteEngine.generateSQL(SQLRewriteEngine.java:507)
        at 
org.apache.shardingsphere.core.BaseShardingEngine.rewriteAndConvert(BaseShardingEngine.java:90)
        at 
org.apache.shardingsphere.core.BaseShardingEngine.shard(BaseShardingEngine.java:65)
        at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.shard(ShardingPreparedStatement.java:224)
        at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.addBatch(ShardingPreparedStatement.java:215)
        at sun.reflect.GeneratedMethodAccessor486.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:45005)
        at java.lang.reflect.Method.invoke(Method.java:483)
   ```
   before insert the data, I have checked the `ArrayList` is empty or is null
   ```java
   if (CollectionUtil.isNotEmpty(saveList)){
               flag = functionRelationService.saveBatch(saveList);
   }
   ```
   

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


With regards,
Apache Git Services

Reply via email to