T - The type of the elements of the sorted and grouped DataSet.public class SortedGrouping<T> extends Grouping<T>
customPartitioner, dataSet, keys| Constructor and Description |
|---|
SortedGrouping(DataSet<T> set,
Keys<T> keys,
int field,
Order order) |
SortedGrouping(DataSet<T> set,
Keys<T> keys,
String field,
Order order) |
| Modifier and Type | Method and Description |
|---|---|
GroupReduceOperator<T,T> |
first(int n)
Returns a new set containing the first n elements in this grouped and sorted
DataSet. |
protected int[] |
getGroupSortKeyPositions() |
protected Order[] |
getGroupSortOrders() |
<R> GroupReduceOperator<T,R> |
reduceGroup(GroupReduceFunction<T,R> reducer)
Applies a GroupReduce transformation on a grouped and sorted
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 or Pojo elements can be sorted.Groups can be sorted by multiple fields by chaining sortGroup(int, Order) calls. |
SortedGrouping<T> |
sortGroup(String field,
Order order)
Sorts
Tuple or POJO elements within a group on the specified field in the specified Order.
Note: Only groups of Tuple or Pojo elements can be sorted.Groups can be sorted by multiple fields by chaining sortGroup(String, Order) calls. |
SortedGrouping<T> |
withPartitioner(Partitioner<?> partitioner)
Uses a custom partitioner for the grouping.
|
getCustomPartitioner, getDataSet, getKeysprotected int[] getGroupSortKeyPositions()
protected Order[] getGroupSortOrders()
public SortedGrouping<T> withPartitioner(Partitioner<?> partitioner)
partitioner - The custom partitioner.public <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 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 or Pojo elements can be sorted.sortGroup(int, Order) calls.public SortedGrouping<T> sortGroup(String field, Order order)
Tuple or POJO elements within a group on the specified field in the specified Order.
Note: Only groups of Tuple or Pojo elements can be sorted.sortGroup(String, Order) calls.Copyright © 2015 The Apache Software Foundation. All rights reserved.