Skip to content

server: polars paging has no row-order tie-break; /load doesn't accept row_order_column (polars side of #974) #995

Open

Description

@paddymul

Problem

handle_infinite_request_buckaroo_polars sorts on the one requested column, filtered_df.with_row_index().sort(col, descending=...) (buckaroo/server/data_loading_polars.py:138), with polars' default maintain_order=False. Polars doesn't define the order of rows with equal keys in that mode, and /load gives the host no way to name a column to break ties.

This is the polars side of #974. tallyman sends row_order_column on /load_expr for it (the xorq path doesn't read it yet either); /load doesn't accept it.

I haven't seen it produce different pages. A sort on a 200-value column over 1.2M rows returned the same 50-row window at offset 600,000 on five calls. The gap is that the order among ties isn't defined, so a host can't promise it, and it can differ from the order the xorq path will use once #974 is fixed.

Impact

tallyman writes a __row_order column (no ties, file order) into every parquet it hands the grid, and defines a page as ordered by the user's sort key and then __row_order, so the same request returns the same rows.

Suggested fix

  • /load accepts row_order_column and stores it on the session.
  • With a sort, order by [sort_col, row_order_column]; without one, by row_order_column (with the sampling fixed this is already file order for tallyman's files).
  • Without the hint, maintain_order=True at least keeps ties in input order.

Context

Found while checking whether tallyman's grid can move from /load_expr to /load with backend: "polars", on buckaroo 0.15.8 (same code on main at 992fdb3).

The other gaps from the same check: #992, #993, #994, #996.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpolars

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions