Merge pull request #1995 from nosqlbench/nosqlbench-1146-batch

fix and document batch support for cqld4
This commit is contained in:
Dave Fisher 2024-07-26 11:15:38 -07:00 committed by GitHub
commit 203da83050
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 6 deletions

View File

@ -69,9 +69,10 @@ public class CqlD4BatchStmtDispenser extends Cqld4BaseOpDispenser {
@NotNull
private LongFunction<Statement> getBatchAccumulator(LongFunction<BatchStatementBuilder> bsb, OpDispenser<? extends Cqld4CqlOp> subopDispenser) {
LongFunction<BatchStatementBuilder> f = l -> {
long base=l*repeat;
BatchStatementBuilder bsa = bsb.apply(l);
for (int i = 0; i < repeat; i++) {
Cqld4CqlOp op = subopDispenser.apply(i+l);
Cqld4CqlOp op = subopDispenser.apply(base+i);
BatchableStatement<?> stmt = (BatchableStatement<?>) op.getStmt();
bsa= bsa.addStatement(stmt);
}

View File

@ -142,12 +142,22 @@ ops:
raw: |
create table if not exist {ksname}.{tblname} ...
# batch statement
# In this case, the word 'testing' is just a place holder due to op template requirements
# Everything under op_template works exactly as it would at the level above it, except that
# op_template is special and activates the batch construction logic.
# All ops within the batch are automatically applied to a virtual cycle which includes the
# repeat value as a step function. For example, with 'repeat: 50',
# - for cycle 0, batch items will be generated as if for cycles 0..49,
# - for cycle 1, batch items will be generated as if for cycles 50..99
# in this way, batch templates are very similar to non-batch templates.
# NOTE: This format is not stable and may change for simplification
example-batch-stmt:
batch:
repeat: 50
op_template:
prepared: |
select three, four from knock.onthedoor where ...
batch: testing
repeat: 50
op_template:
prepared: |
insert into ks.table (key, value) values ({seq_key},{seq_value});
# gremlin statement using the fluent API, as it would be written in a client application
example-fluent-graph-stmt: