public ReduceOperator(Grouping<IN> input, ReduceFunction<IN> function) { super(input.getDataSet(), input.getDataSet().getType()); this.function = function; this.grouper = input; extractSemanticAnnotationsFromUdf(function.getClass()); }
if (this.grouping.getKeys() instanceof Keys.FieldPositionKeys) { int[] logicalKeyPositions = this.grouping.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, IN> operatorInfo = new UnaryOperatorInformation<IN, IN>(getInputType(), getResultType()); GroupReduceOperatorBase<IN, IN, GenericGroupReduce<IN, IN>> po = else if (this.grouping.getKeys() instanceof Keys.SelectorFunctionKeys) { throw new UnsupportedOperationException("Aggregate does not support grouping with KeySelector functions, yet.");
if (grouper.getKeys() instanceof Keys.SelectorFunctionKeys) { Keys.SelectorFunctionKeys<IN, ?> selectorKeys = (Keys.SelectorFunctionKeys<IN, ?>) grouper.getKeys(); else if (grouper.getKeys() instanceof Keys.FieldPositionKeys) { int[] logicalKeyPositions = grouper.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, IN> operatorInfo = new UnaryOperatorInformation<IN, IN>(getInputType(), getInputType()); ReduceOperatorBase<IN, GenericReduce<IN>> po =
/** * Constructor for a grouped reduce. * * @param input The grouped input to be processed group-wise by the groupReduce function. * @param function The user-defined GroupReduce function. */ public ReduceGroupOperator(Grouping<IN> input, GroupReduceFunction<IN, OUT> function) { super(input != null ? input.getDataSet() : null, TypeExtractor.getGroupReduceReturnTypes(function, input.getDataSet().getType())); this.function = function; this.grouper = input; checkCombinability(); extractSemanticAnnotationsFromUdf(function.getClass()); }
if (grouper.getKeys() instanceof Keys.SelectorFunctionKeys) { Keys.SelectorFunctionKeys<IN, ?> selectorKeys = (Keys.SelectorFunctionKeys<IN, ?>) grouper.getKeys(); else if (grouper.getKeys() instanceof Keys.FieldPositionKeys) { int[] logicalKeyPositions = grouper.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, OUT> operatorInfo = new UnaryOperatorInformation<IN, OUT>(getInputType(), getResultType()); GroupReduceOperatorBase<IN, OUT, GenericGroupReduce<IN, OUT>> po =
super(Validate.notNull(input).getDataSet(), input.getDataSet().getType()); if (!input.getDataSet().getType().isTupleType()) { throw new InvalidProgramException("Aggregating on field positions is only possible on tuple data types."); TupleTypeInfo<?> inType = (TupleTypeInfo<?>) input.getDataSet().getType();