import "github.com/apache/beam/sdks/go/pkg/beam/transforms/top"
Package top contains transformations for finding the smallest (or largest) N elements based on arbitrary orderings.
func Largest(s beam.Scope, col beam.PCollection, n int, less interface{}) beam.PCollection
Largest returns the largest N elements of a PCollection<T>. The order is defined by the comparator, less : T x T -> bool. It returns a single-element PCollection<[]T> with a slice of the N largest elements.
Example use:
col := beam.Create(s, 1, 11, 7, 5, 10) top2 := stats.Largest(s, col, 2, less) // PCollection<[]int> with [11, 10] as the only element.
func LargestPerKey(s beam.Scope, col beam.PCollection, n int, less interface{}) beam.PCollection
LargestPerKey returns the largest N values for each key of a PCollection<KV<K,T>>. The order is defined by the comparator, less : T x T -> bool. It returns a PCollection<KV<K,[]T>> with a slice of the N largest elements for each key.
func Smallest(s beam.Scope, col beam.PCollection, n int, less interface{}) beam.PCollection
Smallest returns the smallest N elements of a PCollection<T>. The order is defined by the comparator, less : T x T -> bool. It returns a single-element PCollection<[]T> with a slice of the N smallest elements.
Example use:
col := beam.Create(s, 1, 11, 7, 5, 10) bottom2 := stats.Smallest(s, col, 2, less) // PCollection<[]int> with [1, 5] as the only element.
func SmallestPerKey(s beam.Scope, col beam.PCollection, n int, less interface{}) beam.PCollection
SmallestPerKey returns the smallest N values for each key of a PCollection<KV<K,T>>. The order is defined by the comparator, less : T x T -> bool. It returns a PCollection<KV<K,[]T>> with a slice of the N smallest elements for each key.
Package top imports 11 packages (graph) and is imported by 2 packages. Updated 2021-01-25. Refresh now. Tools for package owners.