use of com.questdb.store.factory.configuration.JournalStructure in project questdb by bluestreak01.
the class SingleJournalQueryTest method testSearchIndexedStrNull.
@Test
public void testSearchIndexedStrNull() throws Exception {
try (JournalWriter w = getFactory().writer(new JournalStructure("tab").$str("id").index().buckets(128).$double("x").$double("y").$ts())) {
Rnd rnd = new Rnd();
ObjHashSet<String> names = new ObjHashSet<>();
for (int i = 0; i < 128; i++) {
names.add(rnd.nextString(15));
}
int mask = 127;
long t = DateFormatUtils.parseDateTime("2015-03-12T00:00:00.000Z");
for (int i = 0; i < 10000; i++) {
JournalEntryWriter ew = w.entryWriter();
if ((rnd.nextPositiveInt() % 10) == 0) {
ew.putNull(0);
} else {
ew.putStr(0, names.get(rnd.nextInt() & mask));
}
ew.putDouble(1, rnd.nextDouble());
ew.putDouble(2, rnd.nextDouble());
ew.putDate(3, t += 10);
ew.append();
}
w.commit();
}
assertNullSearch();
}
use of com.questdb.store.factory.configuration.JournalStructure in project questdb by bluestreak01.
the class SingleJournalQueryTest method testSearchIndexedSymNull.
@Test
public void testSearchIndexedSymNull() throws Exception {
try (JournalWriter w = getFactory().writer(new JournalStructure("tab").$sym("id").index().buckets(128).$double("x").$double("y").$ts())) {
Rnd rnd = new Rnd();
ObjHashSet<String> names = getNames(rnd, 128);
int mask = 127;
long t = DateFormatUtils.parseDateTime("2015-03-12T00:00:00.000Z");
for (int i = 0; i < 10000; i++) {
JournalEntryWriter ew = w.entryWriter();
if ((rnd.nextPositiveInt() % 10) == 0) {
ew.putNull(0);
} else {
ew.putSym(0, names.get(rnd.nextInt() & mask));
}
ew.putDouble(1, rnd.nextDouble());
ew.putDouble(2, rnd.nextDouble());
ew.putDate(3, t += 10);
ew.append();
}
w.commit();
}
assertNullSearch();
}
use of com.questdb.store.factory.configuration.JournalStructure in project questdb by bluestreak01.
the class OperatorTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
// this does thread local allocations that
// should not be accounted for while
// measuring query allocations and de-allocations
FACTORY_CONTAINER.getFactory().getConfiguration().exists("");
try (JournalWriter w = FACTORY_CONTAINER.getFactory().writer(new JournalStructure("abc").$int("i").$double("d").$float("f").$byte("b").$long("l").$str("str").$bool("boo").$sym("sym").$short("sho").$date("date").$ts().$())) {
int n = 1000;
String[] sym = { "AX", "XX", "BZ", "KK" };
Rnd rnd = new Rnd();
long t = Dates.toMillis(2016, 5, 1, 10, 20);
long d = Dates.toMillis(2016, 5, 1, 10, 20);
for (int i = 0; i < n; i++) {
JournalEntryWriter ew = w.entryWriter(t += 60000);
ew.putInt(0, (rnd.nextPositiveInt() & 15) == 0 ? Numbers.INT_NaN : rnd.nextInt());
ew.putDouble(1, (rnd.nextPositiveInt() & 15) == 0 ? Double.NaN : rnd.nextDouble());
ew.putFloat(2, (rnd.nextPositiveInt() & 15) == 0 ? Float.NaN : rnd.nextFloat());
ew.put(3, (byte) rnd.nextInt());
ew.putLong(4, (rnd.nextPositiveInt() & 15) == 0 ? Numbers.LONG_NaN : rnd.nextLong());
ew.putStr(5, (rnd.nextPositiveInt() & 15) == 0 ? null : sym[rnd.nextPositiveInt() % sym.length]);
ew.putBool(6, rnd.nextBoolean());
ew.putSym(7, (rnd.nextPositiveInt() & 15) == 0 ? null : sym[rnd.nextPositiveInt() % sym.length]);
ew.putShort(8, (short) rnd.nextInt());
d += 45000;
ew.putDate(9, (rnd.nextPositiveInt() & 15) == 0 ? Numbers.LONG_NaN : d);
ew.append();
}
w.commit();
}
}
use of com.questdb.store.factory.configuration.JournalStructure 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.factory.configuration.JournalStructure 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();
}
Aggregations