Search in sources :

Example 1 with SlicingWindowOperator

use of org.apache.flink.table.runtime.operators.window.slicing.SlicingWindowOperator in project flink by apache.

the class SlicingWindowAggOperatorBuilder method build.

public SlicingWindowOperator<RowData, ?> build() {
    checkNotNull(assigner);
    checkNotNull(inputSerializer);
    checkNotNull(keySerializer);
    checkNotNull(accSerializer);
    checkNotNull(generatedAggregateFunction);
    boolean isGlobalAgg = localGeneratedAggregateFunction != null && globalGeneratedAggregateFunction != null;
    RecordsCombiner.Factory combinerFactory;
    if (isGlobalAgg) {
        combinerFactory = new GlobalAggCombiner.Factory(localGeneratedAggregateFunction, globalGeneratedAggregateFunction);
    } else {
        combinerFactory = new AggCombiner.Factory(generatedAggregateFunction);
    }
    final WindowBuffer.Factory bufferFactory = new RecordsWindowBuffer.Factory(keySerializer, inputSerializer, combinerFactory);
    final SlicingWindowProcessor<Long> windowProcessor;
    if (assigner instanceof SliceSharedAssigner) {
        windowProcessor = new SliceSharedWindowAggProcessor(generatedAggregateFunction, bufferFactory, (SliceSharedAssigner) assigner, accSerializer, indexOfCountStart, shiftTimeZone);
    } else if (assigner instanceof SliceUnsharedAssigner) {
        windowProcessor = new SliceUnsharedWindowAggProcessor(generatedAggregateFunction, bufferFactory, (SliceUnsharedAssigner) assigner, accSerializer, shiftTimeZone);
    } else {
        throw new IllegalArgumentException("assigner must be instance of SliceUnsharedAssigner or SliceSharedAssigner.");
    }
    return new SlicingWindowOperator<>(windowProcessor);
}
Also used : SliceUnsharedAssigner(org.apache.flink.table.runtime.operators.window.slicing.SliceUnsharedAssigner) SliceSharedWindowAggProcessor(org.apache.flink.table.runtime.operators.aggregate.window.processors.SliceSharedWindowAggProcessor) AggCombiner(org.apache.flink.table.runtime.operators.aggregate.window.combines.AggCombiner) GlobalAggCombiner(org.apache.flink.table.runtime.operators.aggregate.window.combines.GlobalAggCombiner) RecordsCombiner(org.apache.flink.table.runtime.operators.window.combines.RecordsCombiner) WindowBuffer(org.apache.flink.table.runtime.operators.aggregate.window.buffers.WindowBuffer) RecordsWindowBuffer(org.apache.flink.table.runtime.operators.aggregate.window.buffers.RecordsWindowBuffer) SliceSharedAssigner(org.apache.flink.table.runtime.operators.window.slicing.SliceSharedAssigner) GlobalAggCombiner(org.apache.flink.table.runtime.operators.aggregate.window.combines.GlobalAggCombiner) SliceUnsharedWindowAggProcessor(org.apache.flink.table.runtime.operators.aggregate.window.processors.SliceUnsharedWindowAggProcessor) SlicingWindowOperator(org.apache.flink.table.runtime.operators.window.slicing.SlicingWindowOperator)

Aggregations

RecordsWindowBuffer (org.apache.flink.table.runtime.operators.aggregate.window.buffers.RecordsWindowBuffer)1 WindowBuffer (org.apache.flink.table.runtime.operators.aggregate.window.buffers.WindowBuffer)1 AggCombiner (org.apache.flink.table.runtime.operators.aggregate.window.combines.AggCombiner)1 GlobalAggCombiner (org.apache.flink.table.runtime.operators.aggregate.window.combines.GlobalAggCombiner)1 SliceSharedWindowAggProcessor (org.apache.flink.table.runtime.operators.aggregate.window.processors.SliceSharedWindowAggProcessor)1 SliceUnsharedWindowAggProcessor (org.apache.flink.table.runtime.operators.aggregate.window.processors.SliceUnsharedWindowAggProcessor)1 RecordsCombiner (org.apache.flink.table.runtime.operators.window.combines.RecordsCombiner)1 SliceSharedAssigner (org.apache.flink.table.runtime.operators.window.slicing.SliceSharedAssigner)1 SliceUnsharedAssigner (org.apache.flink.table.runtime.operators.window.slicing.SliceUnsharedAssigner)1 SlicingWindowOperator (org.apache.flink.table.runtime.operators.window.slicing.SlicingWindowOperator)1