public class UnsortedGrouping<T> extends Grouping<T>
customPartitioner, dataSet, keys| Constructor and Description |
|---|
UnsortedGrouping(DataSet<T> set,
Keys<T> keys) |
| Modifier and Type | Method and Description |
|---|---|
AggregateOperator<T> |
aggregate(Aggregations agg,
int field)
Applies an Aggregate transformation on a grouped
Tuple DataSet.Note: Only Tuple DataSets can be aggregated. The transformation applies a built-in Aggregation on a specified field
of a Tuple group. |
GroupReduceOperator<T,T> |
first(int n)
Returns a new set containing the first n elements in this grouped
DataSet. |
AggregateOperator<T> |
max(int field)
Syntactic sugar for aggregate (MAX, field)
|
ReduceOperator<T> |
maxBy(int... fields)
Applies a special case of a reduce transformation (maxBy) on a grouped
DataSet.The transformation consecutively calls a ReduceFunction
until only a single element remains which is the result of the transformation. |
AggregateOperator<T> |
min(int field)
Syntactic sugar for aggregate (MIN, field)
|
ReduceOperator<T> |
minBy(int... fields)
Applies a special case of a reduce transformation (minBy) on a grouped
DataSet.The transformation consecutively calls a ReduceFunction
until only a single element remains which is the result of the transformation. |
ReduceOperator<T> |
reduce(ReduceFunction<T> reducer)
Applies a Reduce transformation on a grouped
DataSet.For each group, the transformation consecutively calls a RichReduceFunction
until only a single element for each group remains. |
<R> GroupReduceOperator<T,R> |
reduceGroup(GroupReduceFunction<T,R> reducer)
Applies a GroupReduce transformation on a grouped
DataSet.The transformation calls a RichGroupReduceFunction for each group of the DataSet. |
SortedGrouping<T> |
sortGroup(int field,
Order order)
Sorts
Tuple elements within a group on the specified field in the specified Order.
Note: Only groups of Tuple elements and Pojos can be sorted.Groups can be sorted by multiple fields by chaining sortGroup(int, Order) calls. |
SortedGrouping<T> |
sortGroup(String field,
Order order)
Sorts Pojos within a group on the specified field in the specified
Order.
Note: Only groups of Tuple elements and Pojos can be sorted.Groups can be sorted by multiple fields by chaining sortGroup(String, Order) calls. |
AggregateOperator<T> |
sum(int field)
Syntactic sugar for aggregate (SUM, field)
|
UnsortedGrouping<T> |
withPartitioner(Partitioner<?> partitioner)
Uses a custom partitioner for the grouping.
|
getCustomPartitioner, getDataSet, getKeyspublic UnsortedGrouping<T> withPartitioner(Partitioner<?> partitioner)
partitioner - The custom partitioner.public AggregateOperator<T> aggregate(Aggregations agg, int field)
Tuple DataSet.Aggregation on a specified field
of a Tuple group. Additional aggregation functions can be added to the resulting
AggregateOperator by calling AggregateOperator.and(Aggregations, int).agg - The built-in aggregation function that is computed.field - The index of the Tuple field on which the aggregation function is applied.Tuple,
Aggregations,
AggregateOperator,
DataSetpublic AggregateOperator<T> sum(int field)
field - The index of the Tuple field on which the aggregation function is applied.AggregateOperatorpublic AggregateOperator<T> max(int field)
field - The index of the Tuple field on which the aggregation function is applied.AggregateOperatorpublic AggregateOperator<T> min(int field)
field - The index of the Tuple field on which the aggregation function is applied.AggregateOperatorpublic ReduceOperator<T> reduce(ReduceFunction<T> reducer)
DataSet.RichReduceFunction
until only a single element for each group remains.
A ReduceFunction combines two elements into one new element of the same type.reducer - The ReduceFunction that is applied on each group of the DataSet.RichReduceFunction,
ReduceOperator,
DataSetpublic <R> GroupReduceOperator<T,R> reduceGroup(GroupReduceFunction<T,R> reducer)
DataSet.RichGroupReduceFunction for each group of the DataSet.
A GroupReduceFunction can iterate over all elements of a group and emit any
number of output elements including none.reducer - The GroupReduceFunction that is applied on each group of the DataSet.RichGroupReduceFunction,
GroupReduceOperator,
DataSetpublic GroupReduceOperator<T,T> first(int n)
DataSet.n - The desired number of elements for each group.public ReduceOperator<T> minBy(int... fields)
DataSet.ReduceFunction
until only a single element remains which is the result of the transformation.
A ReduceFunction combines two elements into one new element of the same type.fields - Keys taken into account for finding the minimum.ReduceOperator representing the minimum.public ReduceOperator<T> maxBy(int... fields)
DataSet.ReduceFunction
until only a single element remains which is the result of the transformation.
A ReduceFunction combines two elements into one new element of the same type.fields - Keys taken into account for finding the minimum.ReduceOperator representing the minimum.public SortedGrouping<T> sortGroup(int field, Order order)
Tuple elements within a group on the specified field in the specified Order.
Note: Only groups of Tuple elements and Pojos can be sorted.sortGroup(int, Order) calls.public SortedGrouping<T> sortGroup(String field, Order order)
Order.
Note: Only groups of Tuple elements and Pojos can be sorted.sortGroup(String, Order) calls.field - The Tuple or Pojo field on which the group is sorted.order - The Order in which the specified field is sorted.OrderCopyright © 2015 The Apache Software Foundation. All rights reserved.