if (this.grouping.getKeys() instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = this.grouping.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, IN> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getResultType()); GroupReduceOperatorBase<IN, IN, GroupReduceFunction<IN, IN>> po = po.setCustomPartitioner(grouping.getCustomPartitioner()); else if (this.grouping.getKeys() instanceof Keys.SelectorFunctionKeys) { throw new UnsupportedOperationException("Aggregate does not support grouping with KeySelector functions, yet.");
/** * 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 GroupCombineOperator(Grouping<IN> input, TypeInformation<OUT> resultType, GroupCombineFunction<IN, OUT> function, String defaultName) { super(input != null ? input.getInputDataSet() : null, resultType); this.function = function; this.grouper = input; this.defaultName = defaultName; }
if (grouper.getKeys() instanceof SelectorFunctionKeys) { SelectorFunctionKeys<IN, ?> selectorKeys = (SelectorFunctionKeys<IN, ?>) grouper.getKeys(); else if (grouper.getKeys() instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = grouper.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, OUT> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getResultType()); GroupCombineOperatorBase<IN, OUT, GroupCombineFunction<IN, OUT>> po =
if (grouper.getKeys() instanceof SelectorFunctionKeys) { SelectorFunctionKeys<IN, ?> selectorKeys = (SelectorFunctionKeys<IN, ?>) grouper.getKeys(); else if (grouper.getKeys() instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = grouper.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, OUT> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getResultType()); GroupCombineOperatorBase<IN, OUT, GroupCombineFunction<IN, OUT>> po =
if (this.grouping.getKeys() instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = this.grouping.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, IN> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getResultType()); GroupReduceOperatorBase<IN, IN, GroupReduceFunction<IN, IN>> po = po.setCustomPartitioner(grouping.getCustomPartitioner()); else if (this.grouping.getKeys() instanceof Keys.SelectorFunctionKeys) { throw new UnsupportedOperationException("Aggregate does not support grouping with KeySelector functions, yet.");
public ReduceOperator(Grouping<IN> input, ReduceFunction<IN> function, String defaultName) { super(input.getInputDataSet(), input.getInputDataSet().getType()); this.function = function; this.grouper = input; this.defaultName = defaultName; this.hint = CombineHint.OPTIMIZER_CHOOSES; UdfOperatorUtils.analyzeSingleInputUdf(this, ReduceFunction.class, defaultName, function, grouper.keys); }
if (grouper.getKeys() instanceof SelectorFunctionKeys) { SelectorFunctionKeys<IN, ?> selectorKeys = (SelectorFunctionKeys<IN, ?>) grouper.getKeys(); else if (grouper.getKeys() instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = grouper.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, OUT> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getResultType()); GroupCombineOperatorBase<IN, OUT, GroupCombineFunction<IN, OUT>> po =
if (grouper.getKeys() instanceof SelectorFunctionKeys) { SelectorFunctionKeys<IN, ?> selectorKeys = (SelectorFunctionKeys<IN, ?>) grouper.getKeys(); ((PlanUnwrappingReduceOperator<?, ?>) po.getInput()).setCustomPartitioner(grouper.getCustomPartitioner()); else if (grouper.getKeys() instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = grouper.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, IN> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getInputType()); ReduceOperatorBase<IN, ReduceFunction<IN>> po = new ReduceOperatorBase<>(function, operatorInfo, logicalKeyPositions, name); po.setCustomPartitioner(grouper.getCustomPartitioner());
/** * 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 GroupReduceOperator(Grouping<IN> input, TypeInformation<OUT> resultType, GroupReduceFunction<IN, OUT> function, String defaultName) { super(input != null ? input.getInputDataSet() : null, resultType); this.function = function; this.grouper = input; this.defaultName = defaultName; this.combinable = checkCombinability(); UdfOperatorUtils.analyzeSingleInputUdf(this, GroupReduceFunction.class, defaultName, function, grouper.keys); }
if (grouper.getKeys() instanceof SelectorFunctionKeys) { SelectorFunctionKeys<IN, ?> selectorKeys = (SelectorFunctionKeys<IN, ?>) grouper.getKeys(); po.setCustomPartitioner(grouper.getCustomPartitioner()); return po; } else { po.setCustomPartitioner(grouper.getCustomPartitioner()); return po; else if (grouper.getKeys() instanceof ExpressionKeys) { int[] logicalKeyPositions = grouper.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, OUT> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getResultType()); GroupReduceOperatorBase<IN, OUT, GroupReduceFunction<IN, OUT>> po = po.setInput(input); po.setParallelism(getParallelism()); po.setCustomPartitioner(grouper.getCustomPartitioner());
/** * 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; }
if (this.grouping.getKeys() instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = this.grouping.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, IN> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getResultType()); GroupReduceOperatorBase<IN, IN, GroupReduceFunction<IN, IN>> po = po.setCustomPartitioner(grouping.getCustomPartitioner()); else if (this.grouping.getKeys() instanceof Keys.SelectorFunctionKeys) { throw new UnsupportedOperationException("Aggregate does not support grouping with KeySelector functions, yet.");
/** * 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; }
if (this.grouping.getKeys() instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = this.grouping.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, IN> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getResultType()); GroupReduceOperatorBase<IN, IN, GroupReduceFunction<IN, IN>> po = po.setCustomPartitioner(grouping.getCustomPartitioner()); else if (this.grouping.getKeys() instanceof Keys.SelectorFunctionKeys) { throw new UnsupportedOperationException("Aggregate does not support grouping with KeySelector functions, yet.");
/** * 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 GroupCombineOperator(Grouping<IN> input, TypeInformation<OUT> resultType, GroupCombineFunction<IN, OUT> function, String defaultName) { super(input != null ? input.getInputDataSet() : null, resultType); this.function = function; this.grouper = input; this.defaultName = defaultName; }
if (this.grouping.getKeys() instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = this.grouping.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, IN> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getResultType()); GroupReduceOperatorBase<IN, IN, GroupReduceFunction<IN, IN>> po = po.setCustomPartitioner(grouping.getCustomPartitioner()); else if (this.grouping.getKeys() instanceof Keys.SelectorFunctionKeys) { throw new UnsupportedOperationException("Aggregate does not support grouping with KeySelector functions, yet.");
/** * 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 GroupCombineOperator(Grouping<IN> input, TypeInformation<OUT> resultType, GroupCombineFunction<IN, OUT> function, String defaultName) { super(input != null ? input.getInputDataSet() : null, resultType); this.function = function; this.grouper = input; this.defaultName = defaultName; }
if (this.grouping.getKeys() instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = this.grouping.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, IN> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getResultType()); GroupReduceOperatorBase<IN, IN, GroupReduceFunction<IN, IN>> po = po.setCustomPartitioner(grouping.getCustomPartitioner()); else if (this.grouping.getKeys() instanceof Keys.SelectorFunctionKeys) { throw new UnsupportedOperationException("Aggregate does not support grouping with KeySelector functions, yet.");
public ReduceOperator(Grouping<IN> input, ReduceFunction<IN> function, String defaultName) { super(input.getInputDataSet(), input.getInputDataSet().getType()); this.function = function; this.grouper = input; this.defaultName = defaultName; this.hint = CombineHint.OPTIMIZER_CHOOSES; UdfOperatorUtils.analyzeSingleInputUdf(this, ReduceFunction.class, defaultName, function, grouper.keys); }
if (this.grouping.getKeys() instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = this.grouping.getKeys().computeLogicalKeyPositions(); UnaryOperatorInformation<IN, IN> operatorInfo = new UnaryOperatorInformation<>(getInputType(), getResultType()); GroupReduceOperatorBase<IN, IN, GroupReduceFunction<IN, IN>> po = po.setCustomPartitioner(grouping.getCustomPartitioner()); else if (this.grouping.getKeys() instanceof Keys.SelectorFunctionKeys) { throw new UnsupportedOperationException("Aggregate does not support grouping with KeySelector functions, yet.");