Merge remote-tracking branch 'origin/main' into driver/weaviate

This commit is contained in:
Madhavan Sridharan 2024-07-29 12:14:41 -04:00
commit a0d771c4a7
6 changed files with 52 additions and 14 deletions

View File

@ -546,6 +546,7 @@
<source>21</source>
<release>21</release>
<compilerArgs>
<arg>--enable-preview</arg>
<!-- <compilerArg>-Xdoclint:all</compilerArg>-->
<!-- <compilerArg>-Xlint:all</compilerArg>-->
</compilerArgs>
@ -556,7 +557,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-ea @{argLine}</argLine>
<!-- <argLine>-ea @{argLine}</argLine> -->
<argLine>--enable-preview @{argLine}</argLine>
<systemPropertyVariables>
<Log4jContextSelector>
org.apache.logging.log4j.core.async.AsyncLoggerContextSelector

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:

View File

@ -138,6 +138,7 @@ public class NBCLIOptions {
private static final String DEFAULT_LOGFILE_PATTERN = "VERBOSE";
private final static String ENABLE_DEDICATED_VERIFICATION_LOGGER = "--enable-dedicated-verification-logging";
private final static String DISABLE_NBIO_CACHE = "--disable-nbio-cache";
private final static String USE_NBIO_CACHE = "--use-nbio-cache";
private final static String NBIO_CACHE_FORCE_UPDATE = "--nbio-cache-force-update";
private final static String NBIO_CACHE_NO_VERIFY = "--nbio-cache-no-verify";
private final static String NBIO_CACHE_DIR = "--nbio-cache-dir";
@ -667,6 +668,12 @@ public class NBCLIOptions {
this.heartbeatIntervalMs =
Long.parseLong(this.readWordOrThrow(arglist, "heartbeat interval in ms"));
break;
case USE_NBIO_CACHE:
throw new BasicError(
"The option --use-nbio-cache is no longer supported, " +
"since it is on by default. You may disable it, however, " +
"with --disable-nbio-cache. For more help see docs topic 'nbiocache'."
);
case DISABLE_NBIO_CACHE:
arglist.removeFirst();
this.useNBIOCache = false;
@ -848,18 +855,23 @@ public class NBCLIOptions {
public NBLogLevel getConsoleLogLevel() {
return this.consoleLevel;
}
public boolean wantsToUseNBIOCache() {
return this.useNBIOCache;
}
public boolean wantsNbioCacheForceUpdate() {
return nbioCacheForceUpdate;
}
public boolean wantsNbioCacheVerify() {
return nbioCacheVerify;
}
public String getNbioCacheDir() {
return nbioCacheDir;
}
public String getNbioCacheMaxRetries() {
return nbioCacheMaxRetries;
}
@ -1017,6 +1029,7 @@ public class NBCLIOptions {
);
}
}
public String getUrl() {
return this.url;
}

View File

@ -3,7 +3,7 @@ grammar VirtData;
virtdataRecipe : virtdataFlow (specend virtdataFlow?)* EOF ;
virtdataFlow : (COMPOSE)? expression (';' expression?)* ;
virtdataFlow : (COMPOSE)? expression (';' expression? | WS? expression)* ;
expression : (lvalue ASSIGN)? virtdataCall ;

View File

@ -20,9 +20,12 @@ import io.nosqlbench.virtdata.lang.ast.VirtDataAST;
import io.nosqlbench.virtdata.lang.ast.VirtDataFlow;
import io.nosqlbench.virtdata.lang.generated.VirtDataLexer;
import io.nosqlbench.virtdata.lang.generated.VirtDataParser;
import org.antlr.v4.runtime.BaseErrorListener;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CodePointCharStream;
import org.antlr.v4.runtime.Recognizer;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.RecognitionException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -36,14 +39,11 @@ public class VirtDataDSL {
try {
CodePointCharStream cstream = CharStreams.fromString(input);
VirtDataLexer lexer = new VirtDataLexer(cstream);
CommonTokenStream tokens = new CommonTokenStream(lexer);
VirtDataParser parser = new VirtDataParser(tokens);
VirtDataParser parser = getVirtDataParser(cstream);
VirtDataBuilder astListener = new VirtDataBuilder();
parser.addParseListener(astListener);
VirtDataParser.VirtdataFlowContext virtdataFlowContext = parser.virtdataFlow();
logger.trace(() -> "parse tree: " + virtdataFlowContext.toStringTree(parser));
VirtDataParser.VirtdataRecipeContext virtdataRecipeContext = parser.virtdataRecipe();
logger.trace(() -> "parse tree: " + virtdataRecipeContext.toStringTree(parser));
if (astListener.hasErrors()) {
System.out.println(astListener.getErrorNodes());
@ -67,6 +67,18 @@ public class VirtDataDSL {
}
}
private static VirtDataParser getVirtDataParser(CodePointCharStream cstream) {
VirtDataLexer lexer = new VirtDataLexer(cstream);
lexer.addErrorListener(new BaseErrorListener() {
@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
throw new RuntimeException(e);
}
});
CommonTokenStream tokens = new CommonTokenStream(lexer);
return new VirtDataParser(tokens);
}
public static class ParseResult {
public Throwable throwable;
public VirtDataFlow flow;