use of com.questdb.common.RowCursor in project questdb by bluestreak01.
the class IntervalFrameCursorTest method assertIndexRowsMatchSymbol.
private static void assertIndexRowsMatchSymbol(DataFrameCursor cursor, TableReaderRecord record, int columnIndex, long expectedCount) {
// SymbolTable is table at table scope, so it will be the same for every
// data frame here. Get its instance outside of data frame loop.
SymbolTable symbolTable = cursor.getSymbolTable(columnIndex);
long rowCount = 0;
while (cursor.hasNext()) {
DataFrame frame = cursor.next();
record.jumpTo(frame.getPartitionIndex(), frame.getRowLo());
final long limit = frame.getRowHi();
final long low = frame.getRowLo();
// BitmapIndex is always at data frame scope, each table can have more than one.
// we have to get BitmapIndexReader instance once for each frame.
BitmapIndexReader indexReader = frame.getBitmapIndexReader(columnIndex);
// because out Symbol column 0 is indexed, frame has to have index.
Assert.assertNotNull(indexReader);
int keyCount = indexReader.getKeyCount();
for (int i = 0; i < keyCount; i++) {
RowCursor ic = indexReader.getCursor(i, limit - 1);
CharSequence expected = symbolTable.value(i - 1);
while (ic.hasNext()) {
long row = ic.next();
if (row < low) {
break;
}
record.setRecordIndex(row);
TestUtils.assertEquals(expected, record.getSym(columnIndex));
rowCount++;
}
}
}
Assert.assertEquals(expectedCount, rowCount);
}
use of com.questdb.common.RowCursor in project questdb by bluestreak01.
the class HeapMergingRowSource method prepareCursor.
@Override
public RowCursor prepareCursor(PartitionSlice slice) {
heap.clear();
for (int i = 0, n = sources.length; i < n; i++) {
RowCursor c = Unsafe.arrayGet(sources, i).prepareCursor(slice);
Unsafe.arrayPut(cursors, i, c);
if (c.hasNext()) {
heap.add(i, c.next());
}
}
return this;
}
use of com.questdb.common.RowCursor in project questdb by bluestreak01.
the class HeapRowCursor method of.
public void of(RowCursor[] cursors) {
assert nCursors == cursors.length;
this.cursors = cursors;
this.heap.clear();
for (int i = 0; i < nCursors; i++) {
RowCursor cursor = Unsafe.arrayGet(cursors, i);
if (cursor.hasNext()) {
heap.add(i, cursor.next());
}
}
}
Aggregations