You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/03/29 11:04:07 UTC

[GitHub] [incubator-shardingsphere] zcqshine opened a new issue #2137: batchSave IndexOutOfBoundsException

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:
users@infra.apache.org


With regards,
Apache Git Services