You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
server: /load with backend=polars pages a random 1M-row sample, shuffled, when the file has more rows #992
/load with backend: "polars" pages through a random 1M-row sample, in shuffled order, when the file has more than 1M rows. Every row request, sort and search runs against the sample.
PolarsServerSampling.pre_limit = 1_000_000 (buckaroo/server/data_loading_polars.py:40) reads as a cap on the stats input, but CustomizableDataflow.__init__ passes pre_stats_sample(orig_df) in as the dataflow's raw frame (buckaroo/dataflow/dataflow.py:420), and pre_stats_sample calls df.sample(pre_limit) (buckaroo/dataflow/dataflow_extras.py:68). The sample becomes the table.
Over the server, POST /load on a 1.2M-row parquet answers rows: 1200000, the initial_state carries df_meta: {filtered_rows: 1000000, total_rows: 1200000}, and the first infinite_resp has length: 1000000 with the rows out of file order.
Impact
tallyman would like to hand its grid a parquet path through /load instead of a xorq build through /load_expr. Its entries routinely pass 1M rows (the largest is 78,024,179). Each would show a random slice of its rows, out of order, and the summary stats would describe that slice.
Suggested fix
Keep the frame the grid pages through whole. pre_limit = False on PolarsServerSampling does that, and is what XorqInfiniteSampling already uses.
If stats on very large frames need a cap, sample only what DFStatsClass reads and mark the stats as sampled, rather than replacing raw_df.
Context
Found while checking whether tallyman's grid can move from /load_expr to /load with backend: "polars". Reproduced on buckaroo 0.15.8; the same code is on main at 992fdb3.
pre_limit never capped the stats work. PlDfStatsV2.get_operating_df (buckaroo/pluggable_analysis_framework/df_stats_v2.py:93) already computes stats on a 50,000-row sample whenever rows × cols > 1,000,000. So the only effect of pre_limit = 1_000_000 is that the grid pages a shuffled 1M-row sample.
With pre_limit = False on a 10.8M-row × 43-column parquet: read_parquet took 0.56 s, dataflow construction 0.32 s (stats on the 50k sample), and max RSS was 6.4 GB after the read. The first suggested fix therefore doesn't increase stats cost, though memory grows with the full frame (#993).
The stats are still computed on an unlabelled sample, and that sample applies even to a 52,814-row × 27-column frame. #999 proposes replacing it.
Activity
paddymul commentedon Oct 2, 2026
pre_limitnever capped the stats work.PlDfStatsV2.get_operating_df(buckaroo/pluggable_analysis_framework/df_stats_v2.py:93) already computes stats on a 50,000-row sample whenever rows × cols > 1,000,000. So the only effect ofpre_limit = 1_000_000is that the grid pages a shuffled 1M-row sample.With
pre_limit = Falseon a 10.8M-row × 43-column parquet:read_parquettook 0.56 s, dataflow construction 0.32 s (stats on the 50k sample), and max RSS was 6.4 GB after the read. The first suggested fix therefore doesn't increase stats cost, though memory grows with the full frame (#993).The stats are still computed on an unlabelled sample, and that sample applies even to a 52,814-row × 27-column frame. #999 proposes replacing it.
fix(server): page the whole frame for /load backend=polars (#992)
fix(server): break polars sort ties by row index so paging is repeata…
fix(dataflow): sample the stats input, not the table the grid pages (#…
test(dataflow): failing test for a DFStatsClass without operating_rows (
fix(dataflow): tolerate a DFStatsClass without operating_rows (#992)