Search in sources :

Example 21 with MapValue

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

the class SampleByFillPrevRecordCursor method toTop.

@Override
public void toTop() {
    super.toTop();
    if (base.hasNext()) {
        baseRecord = base.getRecord();
        int n = groupByFunctions.size();
        RecordCursor mapCursor = map.getCursor();
        MapRecord mapRecord = map.getRecord();
        while (mapCursor.hasNext()) {
            MapValue value = mapRecord.getValue();
            // timestamp is always stored in value field 0
            value.putLong(0, Numbers.LONG_NaN);
            // this would set values for when keys are not found right away
            for (int i = 0; i < n; i++) {
                groupByFunctions.getQuick(i).setNull(value);
            }
        }
    }
}
Also used : MapRecord(io.questdb.cairo.map.MapRecord) RecordCursor(io.questdb.cairo.sql.RecordCursor) MapValue(io.questdb.cairo.map.MapValue)

Example 22 with MapValue

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

the class SampleByInterpolateRecordCursorFactory method interpolateBoundaryRange.

private void interpolateBoundaryRange(long x1, long x2, Record record) {
    // interpolating boundary
    for (int i = 0; i < groupByTwoPointFunctionCount; i++) {
        GroupByFunction function = groupByTwoPointFunctions.getQuick(i);
        MapValue startValue = findDataMapValue2(record, x1);
        MapValue endValue = findDataMapValue3(record, x2);
        InterpolationUtil.interpolateBoundary(function, sampler.nextTimestamp(x1), startValue, endValue, true);
        InterpolationUtil.interpolateBoundary(function, x2, startValue, endValue, false);
    }
}
Also used : GroupByFunction(io.questdb.griffin.engine.functions.GroupByFunction) MapValue(io.questdb.cairo.map.MapValue)

Example 23 with MapValue

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

the class HashOuterJoinRecordCursorFactory method buildMap.

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

Aggregations

MapValue (io.questdb.cairo.map.MapValue)23 MapKey (io.questdb.cairo.map.MapKey)17 MapRecord (io.questdb.cairo.map.MapRecord)2 RecordCursor (io.questdb.cairo.sql.RecordCursor)2 SqlExecutionInterruptor (io.questdb.griffin.SqlExecutionInterruptor)2 EmptyTableRandomRecordCursor (io.questdb.griffin.engine.EmptyTableRandomRecordCursor)2 GroupByFunction (io.questdb.griffin.engine.functions.GroupByFunction)2 Function (io.questdb.cairo.sql.Function)1 Record (io.questdb.cairo.sql.Record)1 EmptyTableNoSizeRecordCursor (io.questdb.griffin.engine.EmptyTableNoSizeRecordCursor)1