use of com.questdb.store.JournalWriter in project questdb by bluestreak01.
the class OrderByOptimiserTest method setUpClass.
@BeforeClass
public static void setUpClass() throws Exception {
JournalWriter w = FACTORY_CONTAINER.getFactory().writer(new JournalStructure("tab").$sym("id").index().buckets(128).$double("x").$double("y").$int("i1").$int("i2").$ts());
w.close();
w = FACTORY_CONTAINER.getFactory().writer(new JournalStructure("tex").$sym("id").index().buckets(128).$double("amount").$ts());
w.close();
FACTORY_CONTAINER.getFactory().getConfiguration().exists("");
}
use of com.questdb.store.JournalWriter in project questdb by bluestreak01.
the class RenameJournalTest method create.
private void create(String name) throws JournalException, ParserException {
try (JournalWriter w = compiler.createWriter(getFactory(), "create table " + name + "(a int) record hint 100")) {
JournalEntryWriter ew = w.entryWriter();
ew.putInt(0, 999);
ew.append();
w.commit();
}
}
use of com.questdb.store.JournalWriter in project questdb by bluestreak01.
the class SubqueryOptimiserTest method setUpClass.
@BeforeClass
public static void setUpClass() throws Exception {
JournalWriter w = FACTORY_CONTAINER.getFactory().writer(new JournalStructure("tab").$sym("id").index().buckets(128).$double("x").$double("y").$int("i1").$int("i2").$ts());
w.close();
w = FACTORY_CONTAINER.getFactory().writer(new JournalStructure("tex").$sym("id").index().buckets(128).$double("amount").$ts());
w.close();
}
use of com.questdb.store.JournalWriter in project questdb by bluestreak01.
the class SymbolNullQueryTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
int tradeCount = 100;
int quoteCount = 300;
JournalWriter trades = FACTORY_CONTAINER.getFactory().writer(new JournalStructure("trades").$int("quoteId").$sym("tag1").$double("amount").recordCountHint(tradeCount).$ts());
JournalWriter quotes = FACTORY_CONTAINER.getFactory().writer(new JournalStructure("quotes").$int("quoteId").$sym("tag").$double("rate").recordCountHint(quoteCount).$ts());
int tsIncrementMax = 10000;
long timestamp = DateFormatUtils.parseDateTime("2015-03-23T00:00:00.000Z");
Rnd rnd = new Rnd();
ObjList<String> tags = new ObjList<>();
for (int i = 0; i < 500; i++) {
tags.add(rnd.nextBoolean() ? rnd.nextString(rnd.nextInt() & 15) : null);
}
for (int i = 0; i < quoteCount; i++) {
JournalEntryWriter w = quotes.entryWriter();
w.putInt(0, i);
w.putSym(1, tags.getQuick(rnd.nextPositiveInt() % tags.size()));
w.putDouble(2, rnd.nextDouble());
w.putDate(3, timestamp += rnd.nextPositiveInt() % tsIncrementMax);
w.append();
}
quotes.commit();
timestamp = DateFormatUtils.parseDateTime("2015-03-23T00:00:00.000Z");
for (int i = 0; i < tradeCount; i++) {
JournalEntryWriter w = trades.entryWriter();
w.putInt(0, rnd.nextPositiveInt() % quoteCount);
w.putSym(1, tags.getQuick(rnd.nextPositiveInt() % tags.size()));
w.putDouble(2, rnd.nextDouble());
w.putDate(3, timestamp += rnd.nextPositiveInt() % tsIncrementMax);
w.append();
}
quotes.close();
trades.close();
}
use of com.questdb.store.JournalWriter in project questdb by bluestreak01.
the class GenericBinaryTest method testOutputInput.
@Test
public void testOutputInput() throws Exception {
try (JournalWriter writer = getGenericWriter()) {
List<byte[]> expected = getBytes();
writeOutputStream(writer, expected);
List<byte[]> actual = new ArrayList<>();
try (RecordSource rs = compile("bintest")) {
RecordCursor cursor = rs.prepareCursor(getFactory());
try {
for (Record e : cursor) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
InputStream in = e.getBin(0);
int b;
while ((b = in.read()) != -1) {
out.write(b);
}
actual.add(out.toByteArray());
}
assertEquals(expected, actual);
} finally {
cursor.releaseCursor();
}
}
}
}
Aggregations