use of io.questdb.griffin.SqlExecutionContextImpl in project questdb by bluestreak01.
the class TxSerializerTest method setUpStatic.
@BeforeClass
public static void setUpStatic() {
setCairoStatic();
compiler = new SqlCompiler(engine);
BindVariableServiceImpl bindVariableService = new BindVariableServiceImpl(configuration);
sqlExecutionContext = new SqlExecutionContextImpl(engine, 1).with(AllowAllCairoSecurityContext.INSTANCE, bindVariableService, null, -1, null);
bindVariableService.clear();
}
use of io.questdb.griffin.SqlExecutionContextImpl in project invesdwin-context-persistence by subes.
the class QuestDBPerformanceTest method readIterator.
private void readIterator(final CairoEngine engine) throws InterruptedException, SqlException {
final LoopInterruptedCheck loopCheck = new LoopInterruptedCheck(Duration.ONE_SECOND);
final Instant readsStart = new Instant();
final SqlExecutionContextImpl ctx = new SqlExecutionContextImpl(engine, 1);
try (SqlCompiler compiler = new SqlCompiler(engine)) {
for (int reads = 1; reads <= READS; reads++) {
FDate prevValue = null;
int count = 0;
try (RecordCursorFactory factory = compiler.compile("abc ORDER BY key ASC", ctx).getRecordCursorFactory()) {
try (RecordCursor cursor = factory.getCursor(ctx)) {
final io.questdb.cairo.sql.Record record = cursor.getRecord();
while (cursor.hasNext()) {
final FDate value = new FDate(record.getLong(0));
if (prevValue != null) {
Assertions.checkTrue(prevValue.isBefore(value));
}
prevValue = value;
count++;
}
}
}
Assertions.checkEquals(count, VALUES);
if (loopCheck.check()) {
printProgress("Reads", readsStart, VALUES * reads, VALUES * READS);
}
}
}
printProgress("ReadsFinished", readsStart, VALUES * READS, VALUES * READS);
}
Aggregations