# Conflicts:
#	activitytype-cql/src/main/java/io/nosqlbench/activitytype/cql/core/CqlActivity.java
#	activitytype-cql/src/main/java/io/nosqlbench/activitytype/cql/statements/core/ReadyCQLStatementTemplate.java
This commit is contained in:
Jonathan Shook 2020-04-24 09:12:59 -05:00
commit 8e99b03468
29 changed files with 114 additions and 79 deletions

View File

@ -4,7 +4,7 @@
<parent>
<groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -23,7 +23,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -158,6 +158,7 @@ public class CqlActivity extends SimpleActivity implements Activity, ActivityDef
ParsedStmt parsed = stmtDef.getParsed().orError();
boolean prepared = Boolean.valueOf(stmtDef.getParams().getOrDefault("prepared", "true"));
boolean parametrized = Boolean.valueOf(stmtDef.getParams().getOrDefault("parametrized", "false"));
long ratio = Long.valueOf(stmtDef.getParams().getOrDefault("ratio", "1"));
Optional<ConsistencyLevel> cl = Optional.ofNullable(
@ -223,7 +224,7 @@ public class CqlActivity extends SimpleActivity implements Activity, ActivityDef
simpleStatement.setIdempotent(i);
});
template = new ReadyCQLStatementTemplate(fconfig, getSession(), simpleStatement, ratio,
parsed.getName());
parsed.getName(), parametrized);
}
Optional.ofNullable(stmtDef.getParams().getOrDefault("save", null))

View File

@ -1,19 +1,55 @@
package io.nosqlbench.activitytype.cql.statements.binders;
import com.datastax.driver.core.ConsistencyLevel;
import com.datastax.driver.core.SimpleStatement;
import com.datastax.driver.core.Statement;
import io.nosqlbench.virtdata.core.bindings.ValuesArrayBinder;
/**
* This binder is not meant to be used with anything but DDL or statements
* which should not be trying to parameterize values in general. If this changes,
* support will be added for parameterized values here.
* which should not be trying to parameterize values in general.
* Parametrized values are still possible through parametrized constructor parameter.
* This binder should be avoided in favor of binders returning PreparedStatement
*/
public class SimpleStatementValuesBinder
implements ValuesArrayBinder<SimpleStatement, Statement> {
private final boolean parametrized;
public SimpleStatementValuesBinder(boolean parametrized){
this.parametrized = parametrized;
}
@Override
public Statement bindValues(SimpleStatement context, Object[] values) {
return new SimpleStatement(context.getQueryString(), values);
String query = context.getQueryString();
if(parametrized) {
String[] splits = query.split("\\?");
assert splits.length == values.length+1;
StringBuilder sb = new StringBuilder();
sb.append(splits[0]);
for(int i = 1; i < splits.length; i++) {
sb.append(values[i - 1]);
sb.append(splits[i]);
}
query = sb.toString();
System.out.println(query);
}
SimpleStatement simpleStatement = new SimpleStatement(query);
ConsistencyLevel cl = context.getConsistencyLevel();
if(cl != null){
simpleStatement.setConsistencyLevel(context.getConsistencyLevel());
}
//Does it really makes senses?
ConsistencyLevel serial_cl = context.getSerialConsistencyLevel();
if(serial_cl != null){
simpleStatement.setSerialConsistencyLevel(context.getSerialConsistencyLevel());
}
Boolean idempotent = context.isIdempotent();
if(idempotent != null){
simpleStatement.setIdempotent(idempotent);
}
return simpleStatement;
}
}

View File

@ -52,15 +52,13 @@ public class ReadyCQLStatementTemplate {
this.ratio = ratio;
}
public ReadyCQLStatementTemplate(Map<String,Object> fconfig, Session session, SimpleStatement simpleStatement,
long ratio,
String name) {
public ReadyCQLStatementTemplate(Map<String,Object> fconfig, Session session, SimpleStatement simpleStatement, long ratio, String name, boolean parametrized) {
this.session = session;
this.name = name;
template = new ContextualBindingsArrayTemplate<>(
simpleStatement,
new BindingsTemplate(fconfig),
new SimpleStatementValuesBinder()
new SimpleStatementValuesBinder(parametrized)
);
this.ratio = ratio;
}

View File

@ -4,7 +4,7 @@
<parent>
<groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -24,7 +24,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-cql</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -20,7 +20,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -21,7 +21,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<!-- test scope only -->

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -21,7 +21,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<!-- test scope only -->

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -23,13 +23,13 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-stdout</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<!-- test scope only -->

View File

@ -9,7 +9,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>nb-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
@ -112,7 +112,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -22,7 +22,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -22,13 +22,13 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>nb-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-userlibs</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -23,7 +23,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-core</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
@ -47,7 +47,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-docker</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -28,7 +28,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -77,7 +77,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -28,7 +28,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>docsys</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -22,7 +22,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -3,7 +3,7 @@
<groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -24,31 +24,31 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>driver-web</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-cli</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-docs</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-core</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-extensions</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<!-- <dependency>-->
@ -60,37 +60,37 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-stdout</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-diag</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-tcp</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-http</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-cql</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-cqlverify</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>mvn-defaults</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -23,14 +23,14 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<artifactId>nb-api</artifactId>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lang</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -20,7 +20,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -22,13 +22,13 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lib-basics</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -20,13 +20,13 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lib-basics</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -24,7 +24,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lib-basics</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -17,32 +17,32 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-realdata</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lib-realer</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lib-random</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<artifactId>virtdata-lib-basics</artifactId>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
<artifactId>virtdata-lib-curves4</artifactId>
</dependency>
@ -50,7 +50,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>docsys</artifactId>
<version>3.12.89-SNAPSHOT</version>
<version>3.12.90-SNAPSHOT</version>
</dependency>
<dependency>