partial fix for stubbed sstablegen functionality

This commit is contained in:
Jonathan Shook 2022-09-09 12:36:55 -05:00
parent cd4435324a
commit 8d94cc7dd6
9 changed files with 72 additions and 130 deletions

View File

@ -17,35 +17,32 @@
package io.nosqlbench.adapter.cqld4.opdispensers;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.Statement;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4RainbowTableOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.engine.api.templating.ParsedOp;
import java.util.function.LongFunction;
public class CqlD4RainbowTableDispenser extends BaseOpDispenser<Cqld4RainbowTableOp> {
private final LongFunction<Statement> stmtFunc;
public class CqlD4RainbowTableDispenser extends Cqld4BaseOpDispenser {
// private final LongFunction<Statement> stmtFunc;
private final LongFunction<String> targetFunction;
public CqlD4RainbowTableDispenser(DriverAdapter adapter, LongFunction<CqlSession> sessionFunc, LongFunction<String> targetFunction, ParsedOp cmd) {
super(adapter, sessionFunc,cmd);
this.targetFunction=targetFunction;
this.tableFunc =createTableFunc(cmd);
}
protected LongFunction<Statement> createTableFunc(ParsedOp op) {
// this.tableFunc =createTableFunc(cmd);
}
@Override
public Cqld4RainbowTableOp apply(long value) {
return new Cqld4RainbowTableOp(
getSessionFunc().apply(value),
(RainbowTable) stmtFunc.apply(value),
getMaxPages(),
isRetryReplace()
);
public Cqld4CqlOp apply(long cycle) {
throw new RuntimeException("implement me");
// return new Cqld4RainbowTableOp(
// getSessionFunc().apply(value),
// (RainbowTable) stmtFunc.apply(value),
// getMaxPages(),
// isRetryReplace()
// );
}
}

View File

@ -18,34 +18,36 @@ package io.nosqlbench.adapter.cqld4.opdispensers;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.Statement;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4SsTableOp;
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.engine.api.templating.ParsedOp;
import java.util.function.LongFunction;
public class CqlD4SsTableDispenser extends BaseOpDispenser<Cqld4SsTableOp> {
private final LongFunction<Statement> stmtFunc;
private final LongFunction<String> targetFunction;
public class Cqld4SsTableDispenser extends Cqld4BaseOpDispenser {
public CqlD4SsTableDispenser(DriverAdapter adapter, LongFunction<CqlSession> sessionFunc, LongFunction<String> targetFunction, ParsedOp cmd) {
super(adapter, sessionFunc,cmd);
this.targetFunction=targetFunction;
this.tableFunc =createTableFunc(cmd);
// private final LongFunction<Statement> stmtFunc;
// private final LongFunction<String> targetFunction;
public Cqld4SsTableDispenser(Cqld4DriverAdapter adapter, LongFunction<CqlSession> sessionFunc, LongFunction<String> targetFunction, ParsedOp cmd) {
super(adapter,sessionFunc,cmd);
// this.targetFunction=targetFunction;
// this.tableFunc =createTableFunc(cmd);
}
protected LongFunction<Statement> createTableFunc(ParsedOp op) {
return null;
}
@Override
public Cqld4SsTableOp apply(long value) {
return new CqlD4SsTable(
getSessionFunc().apply(value),
(SsTable) stmtFunc.apply(value),
getMaxPages(),
isRetryReplace()
);
public Cqld4CqlOp apply(long cycle) {
// return new CqlD4SsTable(
// getSessionFunc().apply(value),
// (SsTable) stmtFunc.apply(value),
// getMaxPages(),
// isRetryReplace()
// );
return null;
}
}

View File

@ -63,5 +63,14 @@ public enum CqlD4OpType {
*
* <p>This is the mode that is recommended for all graph usage.</p>
*/
fluent
fluent,
/**
* reserved for future use
*/
rainbow,
// /**
// * reserved for future use
// */
// sst
}

View File

@ -17,8 +17,7 @@
package io.nosqlbench.adapter.cqld4.opmappers;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.opdispensers.CqlD4RainbowTableDispenser;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4RainbowTableOp;
import io.nosqlbench.engine.api.activityimpl.OpDispenser;
import io.nosqlbench.engine.api.activityimpl.OpMapper;
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
@ -38,7 +37,8 @@ public class CqlD4RainbowTableMapper implements OpMapper<Cqld4RainbowTableOp> {
}
@Override
public OpDispenser<? extends Cqld4CqlOp> apply(ParsedOp op) {
return new CqlD4RainbowTableDispenser(adapter, sessionFunc,targetFunction, op);
public OpDispenser<? extends Cqld4RainbowTableOp> apply(ParsedOp op) {
return null;
// return new CqlD4RainbowTableDispenser(adapter, sessionFunc,targetFunction, op);
}
}
}

View File

@ -1,44 +0,0 @@
/*
* Copyright (c) 2022 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.cqld4.opmappers;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.opdispensers.Cqld4SsTableDispenser;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.engine.api.activityimpl.OpDispenser;
import io.nosqlbench.engine.api.activityimpl.OpMapper;
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.engine.api.templating.ParsedOp;
import java.util.function.LongFunction;
public class Cqld4SsTableMapper implements OpMapper<Cqld4SsTableOp> {
private final LongFunction<CqlSession> sessionFunc;
private final LongFunction<String> targetFunction;
private final DriverAdapter adapter;
public CqlD4SsTableMapper(DriverAdapter adapter, LongFunction<CqlSession> sessionFunc, LongFunction<String> targetFunction) {
this.sessionFunc = sessionFunc;
this.targetFunction = targetFunction;
this.adapter = adapter;
}
@Override
public OpDispenser<? extends Cqld4CqlOp> apply(ParsedOp op) {
return new CqlD4SsTableDispenser(adapter, sessionFunc,targetFunction, op);
}
}

View File

@ -75,7 +75,7 @@ public class Cqld4CoreOpMapper implements OpMapper<Op> {
case gremlin -> new Cqld4GremlinOpMapper(adapter, sessionFunc, target.targetFunction).apply(op);
case fluent -> new Cqld4FluentGraphOpMapper(adapter, sessionFunc, target).apply(op);
case rainbow -> new CqlD4RainbowTableMapper(adapter, sessionFunc, target.targetFunction).apply(op);
case sst -> new CqlD4SsTableMapper(adapter, sessionFunc, target.targetFunction).apply(op);
// case sst -> new Cqld4SsTableMapper(adapter, sessionFunc, target.targetFunction).apply(op);
};
}

View File

@ -16,22 +16,35 @@
package io.nosqlbench.adapter.cqld4.optypes;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.RSProcessors;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.*;
import java.util.Map;
// Need to create RainbowTableStatement
public class Cqld4RainbowTableOp implements CycleOp<ResultSet>, VariableCapture, OpGenerator, OpResultSize {
private final CqlSession session;
private final RainbowTableStatement stmt;
// private final CqlSession session;
// private final RainbowTableStatement stmt;
// Rename ResultSet to something more appropriate
public final ResultSet apply(long cycle) {
throw new RuntimeException("implement me");
// TODO: actually write to sstables
// sstable passed to shared memory object
}
public Cqld4RainbowTableOp(CqlSession session, RainbowTableStatement stmt, int maxpages, boolean retryreplace) {
//
@Override
public Op getNextOp() {
throw new RuntimeException("implement me");
}
@Override
public Map<String, ?> capture() {
throw new RuntimeException("implement me");
}
//
// public Cqld4RainbowTableOp(CqlSession session, RainbowTableStatement stmt, int maxpages, boolean retryreplace) {
// //
// }
}

View File

@ -1,37 +0,0 @@
/*
* Copyright (c) 2022 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.cqld4.optypes;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.RSProcessors;
// Need to create SsTableStatement
public class Cqld4SsTableOp implements CycleOp<ResultSet>, VariableCapture, OpGenerator, OpResultSize {
private final CqlSession session;
private final SsTableStatement stmt;
// Rename ResultSet to something more appropriate
public final ResultSet apply(long cycle) {
// TODO: actually write to sstables
// sstable passed to shared memory object
}
public Cqld4SsTableOp(CqlSession session, SsTableStatement stmt, int maxpages, boolean retryreplace) {
}
}

View File

@ -29,6 +29,8 @@ blocks:
prepared: false
ops:
create-keyspace: |
db.createCollection(
db.createCollection("students", {
validator: {
$jsonSchema: {