use of com.questdb.ql.latest.KvIndexSymLookupRowSource in project questdb by bluestreak01.
the class MergingRowSourceTest method testHeapMerge.
@Test
public void testHeapMerge() throws JournalException, NumericException {
try (JournalWriter<Quote> w = getFactory().writer(Quote.class)) {
TestUtils.generateQuoteData(w, 100000, DateFormatUtils.parseDateTime("2014-02-11T00:00:00.000Z"), 10);
RowSource srcA = new KvIndexSymLookupRowSource("sym", "BP.L", true);
RowSource srcB = new KvIndexSymLookupRowSource("sym", "WTB.L", true);
RecordSource rs = new JournalRecordSource(new JournalPartitionSource(w.getMetadata(), true), new HeapMergingRowSource(srcA, srcB));
long last = 0;
RecordCursor c = rs.prepareCursor(getFactory());
try {
int ts = rs.getMetadata().getColumnIndex("timestamp");
while (c.hasNext()) {
long r = c.next().getDate(ts);
Assert.assertTrue(r > last);
last = r;
}
} finally {
c.releaseCursor();
}
}
}
use of com.questdb.ql.latest.KvIndexSymLookupRowSource in project questdb by bluestreak01.
the class MergingRowSourceTest method testMerge.
@Test
public void testMerge() throws JournalException, NumericException {
try (JournalWriter<Quote> w = getFactory().writer(Quote.class)) {
TestUtils.generateQuoteData(w, 100000, DateFormatUtils.parseDateTime("2014-02-11T00:00:00.000Z"), 10);
RowSource srcA = new KvIndexSymLookupRowSource("sym", "BP.L", true);
RowSource srcB = new KvIndexSymLookupRowSource("sym", "WTB.L", true);
try (RecordSource rs = new JournalRecordSource(new JournalPartitionSource(w.getMetadata(), true), new MergingRowSource(srcA, srcB))) {
long last = 0;
RecordCursor c = rs.prepareCursor(getFactory());
try {
int ts = rs.getMetadata().getColumnIndex("timestamp");
while (c.hasNext()) {
long r = c.next().getDate(ts);
Assert.assertTrue(r > last);
last = r;
}
} finally {
c.releaseCursor();
}
}
}
}
Aggregations