mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-28 17:51:06 -06:00
#168 fix parameter types for free params on statements
This commit is contained in:
parent
0dab22253c
commit
e7daf97d91
@ -31,7 +31,6 @@ import io.nosqlbench.engine.api.activityconfig.rawyaml.RawStmtsBlock;
|
||||
import io.nosqlbench.engine.api.activityconfig.rawyaml.RawStmtsDoc;
|
||||
import io.nosqlbench.engine.api.activityconfig.rawyaml.RawStmtsDocList;
|
||||
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
|
||||
import io.nosqlbench.engine.api.activityconfig.yaml.StmtDef;
|
||||
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.engine.api.activityimpl.ParameterMap;
|
||||
@ -165,13 +164,13 @@ public class CqlActivity extends SimpleActivity implements Activity, ActivityDef
|
||||
boolean parametrized = stmtDef.getParamOrDefault("parametrized", false);
|
||||
long ratio = stmtDef.getParamOrDefault("ratio", 1);
|
||||
|
||||
Optional<ConsistencyLevel> cl = stmtDef.getOptionalParam("cl", String.class).map(ConsistencyLevel::valueOf);
|
||||
Optional<ConsistencyLevel> serial_cl = stmtDef.getOptionalParam("serial_cl").map(ConsistencyLevel::valueOf);
|
||||
Optional<Boolean> idempotent = stmtDef.getOptionalParam("idempotent").map(Boolean::parseBoolean);
|
||||
Optional<ConsistencyLevel> cl = stmtDef.getOptionalStringParam("cl", String.class).map(ConsistencyLevel::valueOf);
|
||||
Optional<ConsistencyLevel> serial_cl = stmtDef.getOptionalStringParam("serial_cl").map(ConsistencyLevel::valueOf);
|
||||
Optional<Boolean> idempotent = stmtDef.getOptionalStringParam("idempotent",Boolean.class);
|
||||
|
||||
StringBuilder psummary = new StringBuilder();
|
||||
|
||||
boolean instrument = stmtDef.getOptionalParam("instrument",Boolean.class)
|
||||
boolean instrument = stmtDef.getOptionalStringParam("instrument",Boolean.class)
|
||||
.or(() -> getParams().getOptionalBoolean("instrument"))
|
||||
.orElse(false);
|
||||
|
||||
@ -205,7 +204,7 @@ public class CqlActivity extends SimpleActivity implements Activity, ActivityDef
|
||||
prepare.setIdempotent(i);
|
||||
});
|
||||
|
||||
CqlBinderTypes binderType = stmtDef.getOptionalParam("binder")
|
||||
CqlBinderTypes binderType = stmtDef.getOptionalStringParam("binder")
|
||||
.map(CqlBinderTypes::valueOf)
|
||||
.orElse(CqlBinderTypes.DEFAULT);
|
||||
|
||||
@ -229,7 +228,7 @@ public class CqlActivity extends SimpleActivity implements Activity, ActivityDef
|
||||
parsed.getName(), parametrized);
|
||||
}
|
||||
|
||||
stmtDef.getOptionalParam("save")
|
||||
stmtDef.getOptionalStringParam("save")
|
||||
.map(s -> s.split("[,: ]"))
|
||||
.map(Save::new)
|
||||
.ifPresent(save_op -> {
|
||||
@ -237,7 +236,7 @@ public class CqlActivity extends SimpleActivity implements Activity, ActivityDef
|
||||
template.addRowCycleOperators(save_op);
|
||||
});
|
||||
|
||||
stmtDef.getOptionalParam("rsoperators")
|
||||
stmtDef.getOptionalStringParam("rsoperators")
|
||||
.map(s -> s.split(","))
|
||||
.stream().flatMap(Arrays::stream)
|
||||
.map(ResultSetCycleOperators::newOperator)
|
||||
@ -246,7 +245,7 @@ public class CqlActivity extends SimpleActivity implements Activity, ActivityDef
|
||||
template.addResultSetOperators(rso);
|
||||
});
|
||||
|
||||
stmtDef.getOptionalParam("rowoperators")
|
||||
stmtDef.getOptionalStringParam("rowoperators")
|
||||
.map(s -> s.split(","))
|
||||
.stream().flatMap(Arrays::stream)
|
||||
.map(RowCycleOperators::newOperator)
|
||||
|
@ -19,7 +19,7 @@ package io.nosqlbench.engine.api.activityconfig.rawyaml;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class StatementsOwner extends BlockParams {
|
||||
public class StatementsOwner extends RawStmtFields {
|
||||
|
||||
private List<RawStmtDef> rawStmtDefs = new ArrayList<>();
|
||||
|
||||
@ -42,7 +42,7 @@ public class StatementsOwner extends BlockParams {
|
||||
}
|
||||
|
||||
if (statementsObject!=null) {
|
||||
setByObject(statementsObject);
|
||||
setStatementsFieldByObjectType(statementsObject);
|
||||
}
|
||||
// if (statementsObject!=null) {
|
||||
// if (statementsObject instanceof List) {
|
||||
@ -55,7 +55,7 @@ public class StatementsOwner extends BlockParams {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setByObject(Object object) {
|
||||
public void setStatementsFieldByObjectType(Object object) {
|
||||
if (object instanceof List) {
|
||||
List<Object> stmtList = (List<Object>) object;
|
||||
List<RawStmtDef> defs = new ArrayList<>(stmtList.size());
|
||||
@ -90,7 +90,7 @@ public class StatementsOwner extends BlockParams {
|
||||
throw new RuntimeException("Unknown inner value type on map-based statement definition.");
|
||||
}
|
||||
}
|
||||
setByObject(itemizedMaps);
|
||||
setStatementsFieldByObjectType(itemizedMaps);
|
||||
} else if (object instanceof String) {
|
||||
List<RawStmtDef> defs = new ArrayList<>();
|
||||
defs.add(new RawStmtDef(null,(String)object));
|
||||
|
Loading…
Reference in New Issue
Block a user