Search in sources :

Example 11 with DataFrame

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();
}
Also used : MapKey(io.questdb.cairo.map.MapKey) DataFrame(io.questdb.cairo.sql.DataFrame)

Example 12 with DataFrame

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;
            }
        }
    }
}
Also used : BitmapIndexReader(io.questdb.cairo.BitmapIndexReader) DataFrame(io.questdb.cairo.sql.DataFrame) RowCursor(io.questdb.cairo.sql.RowCursor)

Example 13 with DataFrame

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;
    }
}
Also used : DataFrame(io.questdb.cairo.sql.DataFrame)

Aggregations

DataFrame (io.questdb.cairo.sql.DataFrame)13 BitmapIndexReader (io.questdb.cairo.BitmapIndexReader)4 RowCursor (io.questdb.cairo.sql.RowCursor)3 MapKey (io.questdb.cairo.map.MapKey)2 MessageBus (io.questdb.MessageBus)1 TableReader (io.questdb.cairo.TableReader)1 DataFrameCursor (io.questdb.cairo.sql.DataFrameCursor)1 ReaderOutOfDateException (io.questdb.cairo.sql.ReaderOutOfDateException)1 MemoryR (io.questdb.cairo.vm.api.MemoryR)1 Sequence (io.questdb.mp.Sequence)1 Rnd (io.questdb.std.Rnd)1 LatestByTask (io.questdb.tasks.LatestByTask)1 Test (org.junit.Test)1