Skip to content

Line envelope: cube grid and trace grid place bucket edges differently #24

Open

Description

@jvdd

Summary

An ungrouped minmax line and its line_env cube target both bucket by equal x width, but they do not share one bucket grid. The live cube envelope and the committed server delta can put the same rows in different buckets.

How the two grids differ

  • The trace grid (_bucket_grid in flexviz/trace/line.py) uses the resolved domain (lo, hi). For integer and temporal x the bucket width is the ceiling of span / n_buckets. For float x it is span / n_buckets. The last bucket is closed at hi.
  • The cube grid (_resolved_target_dims in flexviz/engine.py, then fixed_line_envelope2d) pads the upper bound by _HIST_BIN_EPSILON and floors on true division, the histogram convention.

Example, x = 0..9 as Int64, n_points=8 (4 buckets):

path buckets
trace, resident and scan {0,1,2} {3,4,5} {6,7,8} {9}
cube {0,1,2} {3,4} {5,6} {7,8,9}

The grids agree only when the span is a multiple of the bucket count.

Effect

The cube envelope is approximate by design. A line target's commit always POSTs, and the committed delta replaces the live envelope. With different grids the picture can shift at commit time. Architecture.md describes the difference; this issue tracks removing it.

Proposal

Give the line_env target dim its own bin expression built from _bucket_grid, so the cube slice and the committed delta share one grid. Keep the histogram bins as they are. Then the two agree up to plateau ties and the f32 packing of the cube partials, and a test can pin that.

Grouped lines have a larger mismatch: the resident grouped path still buckets by row count. That is tracked in #16.

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