use of io.questdb.cairo.sql.DataFrame in project questdb by bluestreak01.
the class LatestByAllFilteredRecordCursor method buildTreeMap.
@Override
protected void buildTreeMap(SqlExecutionContext executionContext) throws SqlException {
map.clear();
filter.init(this, executionContext);
DataFrame frame;
while ((frame = this.dataFrameCursor.next()) != null) {
final int partitionIndex = frame.getPartitionIndex();
final long rowLo = frame.getRowLo();
final long rowHi = frame.getRowHi() - 1;
recordA.jumpTo(frame.getPartitionIndex(), rowHi);
for (long row = rowHi; row >= rowLo; row--) {
recordA.setRecordIndex(row);
if (filter.getBool(recordA)) {
MapKey key = map.withKey();
key.put(recordA, recordSink);
if (key.create()) {
rows.add(Rows.toRowID(partitionIndex, row));
}
}
}
}
map.clear();
}
use of io.questdb.cairo.sql.DataFrame 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;
}
}
}
}
use of io.questdb.cairo.sql.DataFrame in project questdb by bluestreak01.
the class AlterTableAttachPartitionTest method readAllRows.
private int readAllRows(TableReader tableReader) {
try (FullFwdDataFrameCursor cursor = new FullFwdDataFrameCursor()) {
cursor.of(tableReader);
DataFrame frame;
int count = 0;
while ((frame = cursor.next()) != null) {
for (long index = frame.getRowHi() - 1, lo = frame.getRowLo() - 1; index > lo; index--) {
count++;
}
}
return count;
}
}
Aggregations