org.apache.flink.api.java.aggregation.AggregationFunction Java Examples

The following examples show how to use org.apache.flink.api.java.aggregation.AggregationFunction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Non grouped aggregation.
 */
public AggregateOperator(DataSet<IN> input, Aggregations function, int field, String aggregateLocationName) {
	super(Preconditions.checkNotNull(input), input.getType());
	Preconditions.checkNotNull(function);

	this.aggregateLocationName = aggregateLocationName;

	if (!input.getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.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 is the first aggregation operator after a regular data set (non grouped aggregation)
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = null;
}
 
Example #2
Source File: AggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void reduce(Iterable<T> records, Collector<T> out) {
	final AggregationFunction<Object>[] aggFunctions = this.aggFunctions;
	final int[] fieldPositions = this.fieldPositions;

	// aggregators are initialized from before

	T outT = null;
	for (T record : records) {
		outT = record;

		for (int i = 0; i < fieldPositions.length; i++) {
			Object val = record.getFieldNotNull(fieldPositions[i]);
			aggFunctions[i].aggregate(val);
		}
	}

	for (int i = 0; i < fieldPositions.length; i++) {
		Object aggVal = aggFunctions[i].getAggregate();
		outT.setField(aggVal, fieldPositions[i]);
		aggFunctions[i].initializeAggregate();
	}

	out.collect(outT);
}
 
Example #3
Source File: AggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: AggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Grouped aggregation.
 *
 * @param input
 * @param function
 * @param field
 */
public AggregateOperator(Grouping<IN> input, Aggregations function, int field, String aggregateLocationName) {
	super(Preconditions.checkNotNull(input).getInputDataSet(), input.getInputDataSet().getType());
	Preconditions.checkNotNull(function);

	this.aggregateLocationName = aggregateLocationName;

	if (!input.getInputDataSet().getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.getInputDataSet().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());

	// set the aggregation fields
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = input;
}
 
Example #5
Source File: AggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Non grouped aggregation.
 */
public AggregateOperator(DataSet<IN> input, Aggregations function, int field, String aggregateLocationName) {
	super(Preconditions.checkNotNull(input), input.getType());
	Preconditions.checkNotNull(function);

	this.aggregateLocationName = aggregateLocationName;

	if (!input.getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.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 is the first aggregation operator after a regular data set (non grouped aggregation)
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = null;
}
 
Example #6
Source File: ScalaAggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #7
Source File: ScalaAggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Grouped aggregation.
 *
 * @param input
 * @param function
 * @param field
 */
public ScalaAggregateOperator(Grouping<IN> input, Aggregations function, int field) {
	super(Preconditions.checkNotNull(input).getInputDataSet(), input.getInputDataSet().getType());

	Preconditions.checkNotNull(function);

	if (!input.getInputDataSet().getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.getInputDataSet().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());

	// set the aggregation fields
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = input;
}
 
Example #8
Source File: ScalaAggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Non grouped aggregation.
 */
public ScalaAggregateOperator(org.apache.flink.api.java.DataSet<IN> input, Aggregations function, int field) {
	super(Preconditions.checkNotNull(input), input.getType());

	Preconditions.checkNotNull(function);

	if (!input.getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.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 is the first aggregation operator after a regular data set (non grouped aggregation)
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = null;
}
 
Example #9
Source File: AggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void reduce(Iterable<T> records, Collector<T> out) {
	final AggregationFunction<Object>[] aggFunctions = this.aggFunctions;
	final int[] fieldPositions = this.fieldPositions;

	// aggregators are initialized from before

	T outT = null;
	for (T record : records) {
		outT = record;

		for (int i = 0; i < fieldPositions.length; i++) {
			Object val = record.getFieldNotNull(fieldPositions[i]);
			aggFunctions[i].aggregate(val);
		}
	}

	for (int i = 0; i < fieldPositions.length; i++) {
		Object aggVal = aggFunctions[i].getAggregate();
		outT.setField(aggVal, fieldPositions[i]);
		aggFunctions[i].initializeAggregate();
	}

	out.collect(outT);
}
 
Example #10
Source File: AggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #11
Source File: AggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Grouped aggregation.
 *
 * @param input
 * @param function
 * @param field
 */
public AggregateOperator(Grouping<IN> input, Aggregations function, int field, String aggregateLocationName) {
	super(Preconditions.checkNotNull(input).getInputDataSet(), input.getInputDataSet().getType());
	Preconditions.checkNotNull(function);

	this.aggregateLocationName = aggregateLocationName;

	if (!input.getInputDataSet().getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.getInputDataSet().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());

	// set the aggregation fields
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = input;
}
 
Example #12
Source File: ScalaAggregateOperator.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Non grouped aggregation.
 */
public ScalaAggregateOperator(org.apache.flink.api.java.DataSet<IN> input, Aggregations function, int field) {
	super(Preconditions.checkNotNull(input), input.getType());

	Preconditions.checkNotNull(function);

	if (!input.getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.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 is the first aggregation operator after a regular data set (non grouped aggregation)
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = null;
}
 
Example #13
Source File: ScalaAggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #14
Source File: AggregateOperator.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Grouped aggregation.
 *
 * @param input
 * @param function
 * @param field
 */
public AggregateOperator(Grouping<IN> input, Aggregations function, int field, String aggregateLocationName) {
	super(Preconditions.checkNotNull(input).getInputDataSet(), input.getInputDataSet().getType());
	Preconditions.checkNotNull(function);

	this.aggregateLocationName = aggregateLocationName;

	if (!input.getInputDataSet().getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.getInputDataSet().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());

	// set the aggregation fields
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = input;
}
 
Example #15
Source File: ScalaAggregateOperator.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Grouped aggregation.
 *
 * @param input
 * @param function
 * @param field
 */
public ScalaAggregateOperator(Grouping<IN> input, Aggregations function, int field) {
	super(Preconditions.checkNotNull(input).getInputDataSet(), input.getInputDataSet().getType());

	Preconditions.checkNotNull(function);

	if (!input.getInputDataSet().getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.getInputDataSet().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());

	// set the aggregation fields
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = input;
}
 
Example #16
Source File: ScalaAggregateOperator.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #17
Source File: AggregateOperator.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Non grouped aggregation.
 */
public AggregateOperator(DataSet<IN> input, Aggregations function, int field, String aggregateLocationName) {
	super(Preconditions.checkNotNull(input), input.getType());
	Preconditions.checkNotNull(function);

	this.aggregateLocationName = aggregateLocationName;

	if (!input.getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.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 is the first aggregation operator after a regular data set (non grouped aggregation)
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = null;
}
 
Example #18
Source File: ScalaAggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Grouped aggregation.
 *
 * @param input
 * @param function
 * @param field
 */
public ScalaAggregateOperator(Grouping<IN> input, Aggregations function, int field) {
	super(Preconditions.checkNotNull(input).getInputDataSet(), input.getInputDataSet().getType());

	Preconditions.checkNotNull(function);

	if (!input.getInputDataSet().getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.getInputDataSet().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());

	// set the aggregation fields
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = input;
}
 
Example #19
Source File: AggregateOperator.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #20
Source File: AggregateOperator.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public void reduce(Iterable<T> records, Collector<T> out) {
	final AggregationFunction<Object>[] aggFunctions = this.aggFunctions;
	final int[] fieldPositions = this.fieldPositions;

	// aggregators are initialized from before

	T outT = null;
	for (T record : records) {
		outT = record;

		for (int i = 0; i < fieldPositions.length; i++) {
			Object val = record.getFieldNotNull(fieldPositions[i]);
			aggFunctions[i].aggregate(val);
		}
	}

	for (int i = 0; i < fieldPositions.length; i++) {
		Object aggVal = aggFunctions[i].getAggregate();
		outT.setField(aggVal, fieldPositions[i]);
		aggFunctions[i].initializeAggregate();
	}

	out.collect(outT);
}
 
Example #21
Source File: ScalaAggregateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Non grouped aggregation.
 */
public ScalaAggregateOperator(org.apache.flink.api.java.DataSet<IN> input, Aggregations function, int field) {
	super(Preconditions.checkNotNull(input), input.getType());

	Preconditions.checkNotNull(function);

	if (!input.getType().isTupleType()) {
		throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types.");
	}

	TupleTypeInfoBase<?> inType = (TupleTypeInfoBase<?>) input.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 is the first aggregation operator after a regular data set (non grouped aggregation)
	this.aggregationFunctions.add(aggFunct);
	this.fields.add(field);
	this.grouping = null;
}
 
Example #22
Source File: AggregateOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
public AggregatingUdf(AggregationFunction<Object>[] aggFunctions, int[] fieldPositions) {
	Preconditions.checkNotNull(aggFunctions);
	Preconditions.checkNotNull(aggFunctions);
	Preconditions.checkArgument(aggFunctions.length == fieldPositions.length);

	this.aggFunctions = aggFunctions;
	this.fieldPositions = fieldPositions;
}
 
Example #23
Source File: AggregateOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public AggregatingUdf(AggregationFunction<Object>[] aggFunctions, int[] fieldPositions) {
	Preconditions.checkNotNull(aggFunctions);
	Preconditions.checkNotNull(aggFunctions);
	Preconditions.checkArgument(aggFunctions.length == fieldPositions.length);

	this.aggFunctions = aggFunctions;
	this.fieldPositions = fieldPositions;
}
 
Example #24
Source File: ScalaAggregateOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
public AggregatingUdf(TypeInformation<T> typeInfo, AggregationFunction<Object>[] aggFunctions, int[] fieldPositions) {
	Preconditions.checkNotNull(typeInfo);
	Preconditions.checkNotNull(aggFunctions);
	Preconditions.checkArgument(aggFunctions.length == fieldPositions.length);
	Preconditions.checkArgument(typeInfo.isTupleType(), "TypeInfo for Scala Aggregate Operator must be a tuple TypeInfo.");
	this.typeInfo = typeInfo;
	this.aggFunctions = aggFunctions;
	this.fieldPositions = fieldPositions;
}
 
Example #25
Source File: ScalaAggregateOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void open(Configuration parameters) throws Exception {
	for (AggregationFunction<Object> aggFunction : aggFunctions) {
		aggFunction.initializeAggregate();
	}
	this.serializer = (TupleSerializerBase<T>) typeInfo.createSerializer(getRuntimeContext().getExecutionConfig());
}
 
Example #26
Source File: ScalaAggregateOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void open(Configuration parameters) throws Exception {
	for (AggregationFunction<Object> aggFunction : aggFunctions) {
		aggFunction.initializeAggregate();
	}
	this.serializer = (TupleSerializerBase<T>) typeInfo.createSerializer(getRuntimeContext().getExecutionConfig());
}
 
Example #27
Source File: ScalaAggregateOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public AggregatingUdf(TypeInformation<T> typeInfo, AggregationFunction<Object>[] aggFunctions, int[] fieldPositions) {
	Preconditions.checkNotNull(typeInfo);
	Preconditions.checkNotNull(aggFunctions);
	Preconditions.checkArgument(aggFunctions.length == fieldPositions.length);
	Preconditions.checkArgument(typeInfo.isTupleType(), "TypeInfo for Scala Aggregate Operator must be a tuple TypeInfo.");
	this.typeInfo = typeInfo;
	this.aggFunctions = aggFunctions;
	this.fieldPositions = fieldPositions;
}
 
Example #28
Source File: ScalaAggregateOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void open(Configuration parameters) throws Exception {
	for (AggregationFunction<Object> aggFunction : aggFunctions) {
		aggFunction.initializeAggregate();
	}
	this.serializer = (TupleSerializerBase<T>) typeInfo.createSerializer(getRuntimeContext().getExecutionConfig());
}
 
Example #29
Source File: AggregateOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
public AggregatingUdf(AggregationFunction<Object>[] aggFunctions, int[] fieldPositions) {
	Preconditions.checkNotNull(aggFunctions);
	Preconditions.checkNotNull(aggFunctions);
	Preconditions.checkArgument(aggFunctions.length == fieldPositions.length);

	this.aggFunctions = aggFunctions;
	this.fieldPositions = fieldPositions;
}
 
Example #30
Source File: ScalaAggregateOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
public AggregatingUdf(TypeInformation<T> typeInfo, AggregationFunction<Object>[] aggFunctions, int[] fieldPositions) {
	Preconditions.checkNotNull(typeInfo);
	Preconditions.checkNotNull(aggFunctions);
	Preconditions.checkArgument(aggFunctions.length == fieldPositions.length);
	Preconditions.checkArgument(typeInfo.isTupleType(), "TypeInfo for Scala Aggregate Operator must be a tuple TypeInfo.");
	this.typeInfo = typeInfo;
	this.aggFunctions = aggFunctions;
	this.fieldPositions = fieldPositions;
}