bottomk

Type of operation: Filter

Description

Selects all data for each of the bottom k ranked groups. When multiple groups get equivalent result from the scoring method, they will be ordered by the grouping keys to break ties.

If no scoring method is provided, a default ordering will be used. Default ordering sorts groups by the first numeric column which is not part of the grouping. If no such column is found, groups are sorted by all grouping keys.

Group ranks are exposed as the _c_rank field.

Usage

bottomk k, [ score ], [ groupby ]

Argument

Type

Optional

Repeatable

Restrictions

k

int64

no

no

none

score

expression

yes

no

none

groupby

storable

yes

no

column

Accelerable

bottomk is never accelerable. A dataset that only uses accelerable verbs can be accelerated, making queries on the dataset respond faster.

Examples

bottomk 100

Select the bottom 100 groups using the default ordering method: sorting by the first suitable numeric field and all the group identifiers, or only by all the group identifiers when no suitable numeric field is found. Primary key columns are used here as default group identifiers.

bottomk 100, group_by(clusterUid, namespace)

Similar to the first example, but explicitly specifying the grouping

bottomk 100, min(memory_used)

Select the 100 groups with lowest memory usage in the query window.

bottomk 1, group_by()

This bottomk operates on empty grouping, where all rows belong to the same group, and hence all rows will be selected

bottomk 100, min(memory_used), group_by(clusterUid, namespace)

Rank the minimum memory_used during the query window for each Kubernetes namespace, and select the lowest 100 namespaces.