public class TopList extends Object
Constructor and Description |
---|
TopList() |
Modifier and Type | Method and Description |
---|---|
static <X> PTable<X,Long> |
globalToplist(PCollection<X> input)
Create a list of unique items in the input collection with their count, sorted descending by their frequency.
|
static <K> PTable<K,Long> |
negateCounts(PTable<K,Long> table)
When creating toplists, it is often required to sort by count descending.
|
static <X,Y> PTable<X,Collection<Pair<Long,Y>>> |
topNYbyX(PTable<X,Y> input,
int n)
Create a top-list of elements in the provided PTable, categorised by the key of the input table and using the count
of the value part of the input table.
|
public static <X,Y> PTable<X,Collection<Pair<Long,Y>>> topNYbyX(PTable<X,Y> input, int n)
X
- group typeY
- value typeinput
- table of X Y pairsn
- How many Y values to include in the toplist per X (this will be in memory, so don't make this ridiculous)public static <X> PTable<X,Long> globalToplist(PCollection<X> input)
X
- record typeinput
- input collectionpublic static <K> PTable<K,Long> negateCounts(PTable<K,Long> table)
K
- key typetable
- PTable to processCopyright © 2016 The Apache Software Foundation. All rights reserved.