use of com.questdb.store.JournalEntryWriter in project questdb by bluestreak01.
the class SingleJournalQueryTest method createTabWithNullsAndTime.
private void createTabWithNullsAndTime() throws JournalException, NumericException {
try (JournalWriter w = getFactory().writer(new JournalStructure("tab").$str("id").index().$str("time").$date("date"))) {
Rnd rnd = new Rnd();
long t = DateFormatUtils.parseDateTime("2015-03-12T00:00:00.000Z");
for (int i = 0; i < 100; i++) {
JournalEntryWriter ew = w.entryWriter();
ew.putStr(0, rnd.nextBoolean() ? null : rnd.nextChars(rnd.nextPositiveInt() % 25));
ew.putStr(1, rnd.nextPositiveInt() % 24 + ":" + rnd.nextPositiveInt() % 60);
ew.putDate(2, t);
ew.append();
}
w.commit();
}
}
use of com.questdb.store.JournalEntryWriter in project questdb by bluestreak01.
the class SingleJournalQueryTest method testSearchUnindexedSymNull.
@Test
public void testSearchUnindexedSymNull() throws Exception {
try (JournalWriter w = getFactory().writer(new JournalStructure("tab").$sym("id").$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.JournalEntryWriter in project questdb by bluestreak01.
the class SingleJournalQueryTest method createTabWithSymbol.
private void createTabWithSymbol() throws JournalException, NumericException {
try (JournalWriter w = getFactory().writer(new JournalStructure("tab").$str("id").index().buckets(16).$sym("sym").$double("x").$double("y").$ts())) {
Rnd rnd = new Rnd();
ObjHashSet<String> names = getNames(rnd, 1024);
ObjHashSet<String> syms = new ObjHashSet<>();
for (int i = 0; i < 64; i++) {
syms.add(rnd.nextString(10));
}
int mask = 1023;
long t = DateFormatUtils.parseDateTime("2015-03-12T00:00:00.000Z");
for (int i = 0; i < 10000; i++) {
JournalEntryWriter ew = w.entryWriter();
ew.putStr(0, names.get(rnd.nextInt() & mask));
ew.putDouble(2, rnd.nextDouble());
ew.putDouble(3, rnd.nextDouble());
ew.putDate(4, t += 10);
ew.putSym(1, syms.get(rnd.nextInt() & 63));
ew.append();
}
w.commit();
}
}
use of com.questdb.store.JournalEntryWriter in project questdb by bluestreak01.
the class SingleJournalQueryTest method appendNaNs.
private void appendNaNs(JournalWriter w, long t) throws JournalException {
Rnd rnd = new Rnd();
int n = 128;
ObjHashSet<String> names = getNames(rnd, n);
int mask = n - 1;
for (int i = 0; i < 10000; i++) {
JournalEntryWriter ew = w.entryWriter(t);
ew.putStr(0, names.get(rnd.nextInt() & mask));
ew.putDouble(1, rnd.nextDouble());
if (rnd.nextPositiveInt() % 10 == 0) {
ew.putNull(2);
} else {
ew.putDouble(2, rnd.nextDouble());
}
if (rnd.nextPositiveInt() % 10 == 0) {
ew.putNull(3);
} else {
ew.putLong(3, rnd.nextLong() % 500);
}
ew.putInt(4, rnd.nextInt() % 500);
ew.putDate(5, t += 10);
ew.append();
}
w.commit();
}
use of com.questdb.store.JournalEntryWriter in project questdb by bluestreak01.
the class SingleJournalQueryTest method testScaledDoubleComparison.
@Test
public void testScaledDoubleComparison() throws Exception {
try (JournalWriter w = getFactory().writer(new JournalStructure("tab").$sym("id").index().buckets(128).$double("x").$double("y").$int("i1").$int("i2").$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();
ew.putSym(0, names.get(rnd.nextInt() & mask));
ew.putDouble(1, rnd.nextDouble());
ew.putDouble(2, rnd.nextDouble());
ew.putInt(3, rnd.nextInt() & 63);
ew.putInt(4, rnd.nextInt() & 63);
ew.putDate(5, t += 10);
ew.append();
}
w.commit();
}
final String expected = "YYVSYYEQBORDTQH\t0.000000012344\t0.000000017585\n" + "OXPKRGIIHYHBOQM\t0.000000042571\t0.000000046094\n" + "FUUTOMFUIOXLQLU\t0.000000009395\t0.000000017129\n" + "SCJOUOUIGENFELW\t0.000000000000\t0.000000003106\n" + "KIWIHBROKZKUTIQ\t0.000000001343\t0.000000006899\n" + "KBBQFNPOYNNCTFS\t0.000000001643\t0.000000010727\n" + "CIWXCYXGDHUWEPV\t0.000000000000\t0.000000007289\n" + "KFIJZZYNPPBXBHV\t0.000000007000\t0.000000009292\n" + "HBXOWVYUVVRDPCH\t0.000000000000\t0.000000005734\n" + "XWCKYLSUWDSWUGS\t0.000000010381\t0.000000020362\n" + "KJSMSSUQSRLTKVV\t0.000000003479\t0.000000006929\n" + "CNGZTOYTOXRSFPV\t0.000000000000\t0.000000000000\n" + "NMUREIJUHCLQCMZ\t0.000000001398\t0.000000004552\n" + "KJSMSSUQSRLTKVV\t0.000000004057\t0.000000009300\n" + "YSSMPGLUOHNZHZS\t0.000000003461\t0.000000005232\n" + "TRDLVSYLMSRHGKR\t0.000000001688\t0.000000005004\n" + "EOCVFFKMEKPFOYM\t0.000000002913\t0.000000000653\n" + "JUEBWVLOMPBETTT\t0.000000000000\t0.000000001650\n" + "VQEBNDCQCEHNOMV\t0.000000017353\t0.000000020155\n" + "JUEBWVLOMPBETTT\t0.000000120419\t0.000000111959\n" + "EIWFOQKYHQQUWQO\t0.000000080895\t0.000000081903\n" + "EVMLKCJBEVLUHLI\t0.000000005365\t0.000000003773\n" + "NZVDJIGSYLXGYTE\t0.000000022596\t0.000000017758\n" + "EOCVFFKMEKPFOYM\t0.000000011711\t0.000000006505\n" + "STYSWHLSWPFHXDB\t512.000000000000\t512.000000000000\n" + "IWEODDBHEVGXYHJ\t0.000000000773\t0.000000009342\n" + "KIWIHBROKZKUTIQ\t128.000000000000\t128.000000000000\n" + "VQEBNDCQCEHNOMV\t0.000000003251\t0.000000000000\n" + "BSQCNSFFLTRYZUZ\t-1024.000000000000\t-1024.000000000000\n" + "OPJEUKWMDNZZBBU\t-1024.000000000000\t-1024.000000000000\n" + "DOTSEDYYCTGQOLY\t0.000000004748\t0.000000004680\n" + "CMONRCXNUZFNWHF\t0.000000000000\t0.000000003728\n" + "HYBTVZNCLNXFSUW\t-1024.000000000000\t-1024.000000000000\n" + "EGMITINLKFNUHNR\t0.000000017782\t0.000000023362\n" + "UXBWYWRLHUHJECI\t0.000000009297\t0.000000009220\n" + "HBXOWVYUVVRDPCH\t-512.000000000000\t-512.000000000000\n";
assertThat(expected, "select id, x, y from tab where eq(x, y, 0.00000001)");
}
Aggregations