use of io.questdb.cairo.sql.RowCursor in project questdb by bluestreak01.
the class LatestByValuesIndexedRecordCursor method buildTreeMap.
protected void buildTreeMap() {
final int keyCount = symbolKeys.size();
found.clear();
rows.setPos(0);
DataFrame frame;
while ((frame = this.dataFrameCursor.next()) != null && found.size() < keyCount) {
final BitmapIndexReader indexReader = frame.getBitmapIndexReader(columnIndex, BitmapIndexReader.DIR_BACKWARD);
final long rowLo = frame.getRowLo();
final long rowHi = frame.getRowHi() - 1;
for (int i = 0, n = symbolKeys.size(); i < n; i++) {
int symbolKey = symbolKeys.get(i);
int index = found.keyIndex(symbolKey);
if (index > -1) {
RowCursor cursor = indexReader.getCursor(false, symbolKey, rowLo, rowHi);
if (cursor.hasNext()) {
final long row = Rows.toRowID(frame.getPartitionIndex(), cursor.next());
rows.add(row);
found.addAt(index, symbolKey);
}
}
}
}
index = rows.size() - 1;
}
use of io.questdb.cairo.sql.RowCursor in project questdb by bluestreak01.
the class HeapRowCursor method next.
@Override
public long next() {
int idx = heap.popIndex();
RowCursor cursor = cursors.getQuick(idx);
return cursor.hasNext() ? heap.popAndReplace(idx, cursor.next()) : heap.popValue();
}
use of io.questdb.cairo.sql.RowCursor in project questdb by bluestreak01.
the class HeapRowCursor method of.
public void of(ObjList<RowCursor> cursors) {
int nCursors = cursors.size();
this.cursors = cursors;
this.heap.clear();
for (int i = 0; i < nCursors; i++) {
final RowCursor cursor = cursors.getQuick(i);
if (cursor.hasNext()) {
heap.add(i, cursor.next());
}
}
}
use of io.questdb.cairo.sql.RowCursor in project questdb by bluestreak01.
the class LatestByValueIndexedFilteredRecordCursor method findRecord.
private void findRecord() {
DataFrame frame;
found = false;
while ((frame = this.dataFrameCursor.next()) != null) {
final int partitionIndex = frame.getPartitionIndex();
final BitmapIndexReader indexReader = frame.getBitmapIndexReader(columnIndex, BitmapIndexReader.DIR_BACKWARD);
final long rowLo = frame.getRowLo();
final long rowHi = frame.getRowHi() - 1;
this.recordA.jumpTo(partitionIndex, 0);
RowCursor cursor = indexReader.getCursor(false, symbolKey, rowLo, rowHi);
while (cursor.hasNext()) {
recordA.setRecordIndex(cursor.next());
if (filter.getBool(recordA)) {
found = true;
return;
}
}
}
}
Aggregations