Search in sources :

Example 1 with Window

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

the class StreamArrowPythonGroupWindowAggregateFunctionOperatorTest method getTestOperator.

@Override
public AbstractArrowPythonAggregateFunctionOperator getTestOperator(Configuration config, PythonFunctionInfo[] pandasAggregateFunctions, RowType inputType, RowType outputType, int[] groupingSet, int[] udafInputOffsets) {
    long size = 10000L;
    long slide = 5000L;
    SlidingWindowAssigner windowAssigner = SlidingWindowAssigner.of(Duration.ofMillis(size), Duration.ofMillis(slide)).withEventTime();
    EventTimeTriggers.AfterEndOfWindow<Window> trigger = EventTimeTriggers.afterEndOfWindow();
    RowType udfInputType = (RowType) Projection.of(udafInputOffsets).project(inputType);
    RowType udfOutputType = (RowType) Projection.range(groupingSet.length, outputType.getFieldCount() - 2).project(outputType);
    return new PassThroughStreamArrowPythonGroupWindowAggregateFunctionOperator(config, pandasAggregateFunctions, inputType, udfInputType, udfOutputType, 3, windowAssigner, trigger, 0, new NamedWindowProperty[] { new NamedWindowProperty("start", new WindowStart(null)), new NamedWindowProperty("end", new WindowEnd(null)) }, UTC_ZONE_ID, ProjectionCodeGenerator.generateProjection(CodeGeneratorContext.apply(new TableConfig()), "UdafInputProjection", inputType, udfInputType, udafInputOffsets));
}
Also used : Window(org.apache.flink.table.runtime.operators.window.Window) NamedWindowProperty(org.apache.flink.table.runtime.groupwindow.NamedWindowProperty) SlidingWindowAssigner(org.apache.flink.table.runtime.operators.window.assigners.SlidingWindowAssigner) WindowStart(org.apache.flink.table.runtime.groupwindow.WindowStart) RowType(org.apache.flink.table.types.logical.RowType) WindowEnd(org.apache.flink.table.runtime.groupwindow.WindowEnd) TableConfig(org.apache.flink.table.api.TableConfig) EventTimeTriggers(org.apache.flink.table.runtime.operators.window.triggers.EventTimeTriggers)

Aggregations

TableConfig (org.apache.flink.table.api.TableConfig)1 NamedWindowProperty (org.apache.flink.table.runtime.groupwindow.NamedWindowProperty)1 WindowEnd (org.apache.flink.table.runtime.groupwindow.WindowEnd)1 WindowStart (org.apache.flink.table.runtime.groupwindow.WindowStart)1 Window (org.apache.flink.table.runtime.operators.window.Window)1 SlidingWindowAssigner (org.apache.flink.table.runtime.operators.window.assigners.SlidingWindowAssigner)1 EventTimeTriggers (org.apache.flink.table.runtime.operators.window.triggers.EventTimeTriggers)1 RowType (org.apache.flink.table.types.logical.RowType)1