Search in sources :

Example 1 with AggregationFunctionFactory

use of org.apache.flink.api.java.aggregation.AggregationFunctionFactory in project flink by apache.

the class AggregateOperator method and.

public AggregateOperator<IN> and(Aggregations function, int field) {
    Preconditions.checkNotNull(function);
    TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) getType();
    if (field < 0 || field >= inType.getArity()) {
        throw new IllegalArgumentException("Aggregation field position is out of range.");
    }
    AggregationFunctionFactory factory = function.getFactory();
    AggregationFunction<?> aggFunct = factory.createAggregationFunction(inType.getTypeAt(field).getTypeClass());
    this.aggregationFunctions.add(aggFunct);
    this.fields.add(field);
    return this;
}
Also used : TupleTypeInfoBase(org.apache.flink.api.java.typeutils.TupleTypeInfoBase) AggregationFunctionFactory(org.apache.flink.api.java.aggregation.AggregationFunctionFactory)

Example 2 with AggregationFunctionFactory

use of org.apache.flink.api.java.aggregation.AggregationFunctionFactory in project flink by apache.

the class ScalaAggregateOperator method and.

public ScalaAggregateOperator<IN> and(Aggregations function, int field) {
    Preconditions.checkNotNull(function);
    TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) getType();
    if (field < 0 || field >= inType.getArity()) {
        throw new IllegalArgumentException("Aggregation field position is out of range.");
    }
    AggregationFunctionFactory factory = function.getFactory();
    AggregationFunction<?> aggFunct = factory.createAggregationFunction(inType.getTypeAt(field).getTypeClass());
    this.aggregationFunctions.add(aggFunct);
    this.fields.add(field);
    return this;
}
Also used : TupleTypeInfoBase(org.apache.flink.api.java.typeutils.TupleTypeInfoBase) AggregationFunctionFactory(org.apache.flink.api.java.aggregation.AggregationFunctionFactory)

Aggregations

AggregationFunctionFactory (org.apache.flink.api.java.aggregation.AggregationFunctionFactory)2 TupleTypeInfoBase (org.apache.flink.api.java.typeutils.TupleTypeInfoBase)2