mirror of https://github.com/apache/cassandra
Fix IndexOutOfBoundsException when using empty BATCH statements
patch by Vovodroid; reviewed by Benjamin Lerer for CASSANDRA-10277
This commit is contained in:
parent
b62fde1bb7
commit
1a2a1d2c24
|
|
@ -510,7 +510,7 @@ public class BatchStatement implements CQLStatement
|
|||
|
||||
// Use the CFMetadata of the first statement for partition key bind indexes. If the statements affect
|
||||
// multiple tables, we won't send partition key bind indexes.
|
||||
Short[] partitionKeyBindIndexes = haveMultipleCFs ? null
|
||||
Short[] partitionKeyBindIndexes = (haveMultipleCFs || batchStatement.statements.isEmpty())? null
|
||||
: boundNames.getPartitionKeyBindIndexes(batchStatement.statements.get(0).cfm);
|
||||
|
||||
return new ParsedStatement.Prepared(batchStatement, boundNames, partitionKeyBindIndexes);
|
||||
|
|
|
|||
|
|
@ -103,4 +103,10 @@ public class BatchTest extends CQLTester
|
|||
row(111, "batchtext", null)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBatchEmpty() throws Throwable
|
||||
{
|
||||
execute("BEGIN BATCH APPLY BATCH;");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue