top

package
v2.25.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package top contains transformations for finding the smallest (or largest) N elements based on arbitrary orderings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Largest

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

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

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

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL