use of org.apache.flink.table.api.TableConfig in project flink by apache.
the class PythonTableFunctionOperatorTest method getTestOperator.
@Override
public PythonTableFunctionOperator getTestOperator(Configuration config, PythonFunctionInfo tableFunction, RowType inputType, RowType outputType, int[] udfInputOffsets, JoinRelType joinRelType) {
final RowType udfInputType = (RowType) Projection.of(udfInputOffsets).project(inputType);
final RowType udfOutputType = (RowType) Projection.range(inputType.getFieldCount(), outputType.getFieldCount()).project(outputType);
return new PassThroughPythonTableFunctionOperator(config, tableFunction, inputType, udfInputType, udfOutputType, JoinTypeUtil.getFlinkJoinType(joinRelType), ProjectionCodeGenerator.generateProjection(CodeGeneratorContext.apply(new TableConfig()), "UdtfInputProjection", inputType, udfInputType, udfInputOffsets));
}
use of org.apache.flink.table.api.TableConfig in project flink by apache.
the class BatchArrowPythonGroupAggregateFunctionOperatorTest method getTestOperator.
@Override
public AbstractArrowPythonAggregateFunctionOperator getTestOperator(Configuration config, PythonFunctionInfo[] pandasAggregateFunctions, RowType inputType, RowType outputType, int[] groupingSet, int[] udafInputOffsets) {
RowType udfInputType = (RowType) Projection.of(udafInputOffsets).project(inputType);
RowType udfOutputType = (RowType) Projection.range(groupingSet.length, outputType.getFieldCount()).project(outputType);
return new PassThroughBatchArrowPythonGroupAggregateFunctionOperator(config, pandasAggregateFunctions, inputType, udfInputType, udfOutputType, ProjectionCodeGenerator.generateProjection(CodeGeneratorContext.apply(new TableConfig()), "UdafInputProjection", inputType, udfInputType, udafInputOffsets), ProjectionCodeGenerator.generateProjection(CodeGeneratorContext.apply(new TableConfig()), "GroupKey", inputType, (RowType) Projection.of(groupingSet).project(inputType), groupingSet), ProjectionCodeGenerator.generateProjection(CodeGeneratorContext.apply(new TableConfig()), "GroupSet", inputType, (RowType) Projection.of(groupingSet).project(inputType), groupingSet));
}
use of org.apache.flink.table.api.TableConfig in project flink by apache.
the class BatchArrowPythonOverWindowAggregateFunctionOperatorTest method getTestOperator.
@Override
public AbstractArrowPythonAggregateFunctionOperator getTestOperator(Configuration config, PythonFunctionInfo[] pandasAggregateFunctions, RowType inputRowType, RowType outputRowType, int[] groupingSet, int[] udafInputOffsets) {
RowType udfInputType = (RowType) Projection.of(udafInputOffsets).project(inputRowType);
RowType udfOutputType = (RowType) Projection.range(inputRowType.getFieldCount(), outputRowType.getFieldCount()).project(outputRowType);
return new PassThroughBatchArrowPythonOverWindowAggregateFunctionOperator(config, pandasAggregateFunctions, inputRowType, udfInputType, udfOutputType, new long[] { 0L, Long.MIN_VALUE }, new long[] { 0L, 2L }, new boolean[] { true, false }, new int[] { 0 }, 3, true, ProjectionCodeGenerator.generateProjection(CodeGeneratorContext.apply(new TableConfig()), "UdafInputProjection", inputRowType, udfInputType, udafInputOffsets), ProjectionCodeGenerator.generateProjection(CodeGeneratorContext.apply(new TableConfig()), "GroupKey", inputRowType, (RowType) Projection.of(groupingSet).project(inputRowType), groupingSet), ProjectionCodeGenerator.generateProjection(CodeGeneratorContext.apply(new TableConfig()), "GroupSet", inputRowType, (RowType) Projection.of(groupingSet).project(inputRowType), groupingSet));
}
use of org.apache.flink.table.api.TableConfig 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));
}
use of org.apache.flink.table.api.TableConfig in project flink by apache.
the class StreamArrowPythonRowTimeBoundedRangeOperatorTest method getTestOperator.
@Override
public AbstractArrowPythonAggregateFunctionOperator getTestOperator(Configuration config, PythonFunctionInfo[] pandasAggregateFunctions, RowType inputType, RowType outputType, int[] groupingSet, int[] udafInputOffsets) {
RowType udfInputType = (RowType) Projection.of(udafInputOffsets).project(inputType);
RowType udfOutputType = (RowType) Projection.range(inputType.getFieldCount(), outputType.getFieldCount()).project(outputType);
return new PassThroughStreamArrowPythonRowTimeBoundedRangeOperator(config, pandasAggregateFunctions, inputType, udfInputType, udfOutputType, 3, 3L, ProjectionCodeGenerator.generateProjection(CodeGeneratorContext.apply(new TableConfig()), "UdafInputProjection", inputType, udfInputType, udafInputOffsets));
}
Aggregations