Search in sources :

Example 21 with MapKey

use of io.questdb.cairo.map.MapKey in project questdb by bluestreak01.

the class LatestByAllRecordCursor method buildTreeMap.

@Override
protected void buildTreeMap(SqlExecutionContext executionContext) {
    DataFrame frame;
    try {
        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);
                MapKey key = map.withKey();
                key.put(recordA, recordSink);
                if (key.create()) {
                    rows.add(Rows.toRowID(partitionIndex, row));
                }
            }
        }
    } finally {
        map.clear();
    }
}
Also used : MapKey(io.questdb.cairo.map.MapKey) DataFrame(io.questdb.cairo.sql.DataFrame)

Example 22 with MapKey

use of io.questdb.cairo.map.MapKey in project questdb by bluestreak01.

the class HashJoinLightRecordCursorFactory method buildMapOfSlaveRecords.

private void buildMapOfSlaveRecords(RecordCursor slaveCursor, SqlExecutionInterruptor interruptor) {
    slaveChain.clear();
    joinKeyMap.clear();
    final Record record = slaveCursor.getRecord();
    while (slaveCursor.hasNext()) {
        interruptor.checkInterrupted();
        MapKey key = joinKeyMap.withKey();
        key.put(record, slaveKeySink);
        MapValue value = key.createValue();
        if (value.isNew()) {
            final long offset = slaveChain.put(record.getRowId(), -1);
            value.putLong(0, offset);
            value.putLong(1, offset);
        } else {
            value.putLong(1, slaveChain.put(record.getRowId(), value.getLong(1)));
        }
    }
}
Also used : MapKey(io.questdb.cairo.map.MapKey) MapValue(io.questdb.cairo.map.MapValue)

Example 23 with MapKey

use of io.questdb.cairo.map.MapKey in project questdb by bluestreak01.

the class HashOuterJoinLightRecordCursorFactory method buildMapOfSlaveRecords.

private void buildMapOfSlaveRecords(RecordCursor slaveCursor, SqlExecutionInterruptor interruptor) {
    slaveChain.clear();
    joinKeyMap.clear();
    final Record record = slaveCursor.getRecord();
    while (slaveCursor.hasNext()) {
        interruptor.checkInterrupted();
        MapKey key = joinKeyMap.withKey();
        key.put(record, slaveKeySink);
        MapValue value = key.createValue();
        if (value.isNew()) {
            final long offset = slaveChain.put(record.getRowId(), -1);
            value.putLong(0, offset);
            value.putLong(1, offset);
        } else {
            value.putLong(1, slaveChain.put(record.getRowId(), value.getLong(1)));
        }
    }
}
Also used : MapKey(io.questdb.cairo.map.MapKey) MapValue(io.questdb.cairo.map.MapValue)

Example 24 with MapKey

use of io.questdb.cairo.map.MapKey in project questdb by bluestreak01.

the class QMapReadBenchmark method testDirectMap.

@Benchmark
public MapValue testDirectMap() {
    MapKey key = map.withKey();
    key.putStr(rnd.nextChars(M));
    return key.findValue();
}
Also used : MapKey(io.questdb.cairo.map.MapKey)

Example 25 with MapKey

use of io.questdb.cairo.map.MapKey in project questdb by bluestreak01.

the class QMapReadBenchmark method testQMap.

@Benchmark
public MapValue testQMap() {
    MapKey key = qmap.withKey();
    key.putStr(rnd.nextChars(M));
    return key.findValue();
}
Also used : MapKey(io.questdb.cairo.map.MapKey)

Aggregations

MapKey (io.questdb.cairo.map.MapKey)34 MapValue (io.questdb.cairo.map.MapValue)17 DataFrame (io.questdb.cairo.sql.DataFrame)2 Record (io.questdb.cairo.sql.Record)2 SqlExecutionInterruptor (io.questdb.griffin.SqlExecutionInterruptor)2 EmptyTableRandomRecordCursor (io.questdb.griffin.engine.EmptyTableRandomRecordCursor)2 EmptyTableNoSizeRecordCursor (io.questdb.griffin.engine.EmptyTableNoSizeRecordCursor)1