mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-23 09:16:37 -06:00
provide an empty value type for op templates
This commit is contained in:
parent
7af2680034
commit
2b521edbbf
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -31,6 +31,10 @@ public class RawStmtsDocList {
|
||||
return new RawStmtsDocList(List.of(rawStmtsDoc));
|
||||
}
|
||||
|
||||
public static RawStmtsDocList none() {
|
||||
return new RawStmtsDocList(List.of());
|
||||
}
|
||||
|
||||
public List<RawStmtsDoc> getStmtsDocs() {
|
||||
return rawStmtsDocList;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -41,6 +41,10 @@ public class StmtsDocList implements Iterable<StmtsDoc> {
|
||||
this.rawStmtsDocList = rawStmtsDocList;
|
||||
}
|
||||
|
||||
public static StmtsDocList none() {
|
||||
return new StmtsDocList(RawStmtsDocList.none());
|
||||
}
|
||||
|
||||
public List<StmtsDoc> getStmtDocs(String tagFilter) {
|
||||
TagFilter tf = new TagFilter(tagFilter);
|
||||
return getStmtDocs().stream()
|
||||
@ -67,7 +71,6 @@ public class StmtsDocList implements Iterable<StmtsDoc> {
|
||||
TagFilter ts = new TagFilter(tagFilterSpec);
|
||||
List<OpTemplate> opTemplates = new ArrayList<>();
|
||||
|
||||
|
||||
getStmtDocs().stream()
|
||||
.flatMap(d -> d.getStmts().stream())
|
||||
.filter(ts::matchesTagged)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -652,19 +652,17 @@ public class SimpleActivity implements Activity, ProgressCapable, ActivityDefObs
|
||||
protected StmtsDocList loadStmtsDocList() {
|
||||
|
||||
try {
|
||||
StmtsDocList stmtsDocList = null;
|
||||
|
||||
Optional<String> stmt = activityDef.getParams().getOptionalString("op", "stmt", "statement");
|
||||
Optional<String> op_yaml_loc = activityDef.getParams().getOptionalString("yaml", "workload");
|
||||
if (stmt.isPresent()) {
|
||||
stmtsDocList = StatementsLoader.loadStmt(logger, stmt.get(), activityDef.getParams());
|
||||
workloadSource = "commandline:" + stmt.get();
|
||||
return StatementsLoader.loadStmt(logger, stmt.get(), activityDef.getParams());
|
||||
} else if (op_yaml_loc.isPresent()) {
|
||||
stmtsDocList = StatementsLoader.loadPath(logger, op_yaml_loc.get(), activityDef.getParams(), "activities");
|
||||
workloadSource = "yaml:" + op_yaml_loc.get();
|
||||
return StatementsLoader.loadPath(logger, op_yaml_loc.get(), activityDef.getParams(), "activities");
|
||||
}
|
||||
|
||||
return stmtsDocList;
|
||||
return StmtsDocList.none();
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new OpConfigError("Error loading op templates: " + e, workloadSource, e);
|
||||
|
Loading…
Reference in New Issue
Block a user