BottomK / Manipulation Layer

Select the bottom K rows after sorting by specified column(s). Similar to pandas' nsmallest() or SQL's ORDER BY with LIMIT.

Key features:

  • Multi-column sorting support
  • Customizable null handling
  • Order preservation options

Common applications:

  • Finding lowest values (prices, scores, metrics)
  • Identifying worst performers
  • Bottom percentile analysis
  • Outlier detection
  • Ranking and prioritization

Example: With K=5, get the 5 products with lowest prices, or 5 students with lowest test scores.

Table
0
0
Table

SortBy

[, ...]

Ordered list of columns defining the sort criteria. Multiple columns enable:

  • Primary and secondary sort keys
  • Tie-breaking rules
  • Complex sorting hierarchies Example: sort by price, then by rating for same-price items.

Select

column

Column to use in sort criteria. Examples:

  • Numerical: prices, scores, measurements
  • Temporal: dates, timestamps
  • Text: names, codes (alphabetical) Multiple columns create a hierarchical sort order.
false

Controls sort direction for this column:

  • false (default): Ascending (smallest first)
  • true: Descending (largest first) Useful for mixed sorting requirements.

K

u32
0

Number of rows to select from the bottom of sorted data. Examples:

  • 10 lowest prices
  • 5 worst-performing items
  • 20 oldest records Must be positive and not exceed total row count.
false

Controls null value placement in sort order:

  • false (default): Nulls first
  • true: Nulls last Important for datasets with missing values.
false

Controls stability of sort within equal values:

  • false (default): May reorder equal values
  • true: Preserves original order of equal values Critical for reproducible results or order-sensitive data.