Skip to content

Box is not out of core: exact quantiles materialize the column #42

Open

Description

@jvdd

Problem

The box trace computes exact quantiles with pl.col(...).quantile(...) (flexviz/trace/box.py:145-158), grouped and ungrouped. Polars computes an exact quantile in memory: it materializes the whole data column (per group for the grouped case). So box peak memory grows with row count. It is not O(1) in rows, so box is not true out of core.

This is verified by the OOC matrix test on this branch. box and box-grouped are strict-xfail in tests/test_ooc.py with reason "Polars quantile runs in memory".

State

  • Polars 1.44 has no approximate/streaming quantile, grouped or ungrouped.
  • Box stays as is for now.

Option

An approximate box built on the existing histogram fold would give O(1) memory: bin the column once out of core, then read the quantiles off the cumulative bin counts. About 30 lines. Trade exactness for bounded memory. File only if a user needs box on data that does not fit in memory.

Related: #18 (line aggregation strategies), #19 (dense/high-cardinality OOC).

Activity

  1. jvdd commented on Oct 4, 2026

    @jvdd
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions