use of org.apache.flink.table.runtime.operators.aggregate.window.processors.SliceUnsharedWindowAggProcessor 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);
}
Aggregations