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
Commit 6450a99
Browse filesBrowse the repository at this point in the historyBrowse files
fix: take a hash aggregate's groups out before their keys overflow 32-bit offsets
A hash aggregate interns the bytes of every distinct Utf8 or Binary group
key into one buffer addressed by i32 offsets, and only empties it when the
memory pool refuses the table. With a large enough pool a task with more
than 2 GiB of distinct key bytes fails with "offset overflow, buffer size >
2147483647" (multi-column keys) or panics in ArrowBytesMap (one key column).
Stage 308 of ads_manual_product_rank_cohorts (SELECT DISTINCT date,
product_id, country over 5.8 billion feed rows hash-partitioned by date into
16 tasks, ~167 million groups each) failed this way 24 times on 2026-10-05;
a retry passed only when the pool spilled first. DataFusion 55.1.0 and its
main branch do the same (apache/datafusion#23694, #24704).
Each group values implementation now tells whether a batch's keys still fit
the 32-bit offsets of what it holds: the byte builders by their buffer
length plus the batch's value bytes, the single-column map by the bytes it
interned, and the row-format ones, whose decoded offsets never exceed their
encoded size, by that size plus the batch's largest offset extent at any
depth. When a batch would not fit, the table takes out every group so far
before interning it: a partial aggregate emits them as it does under memory
pressure, a final or single aggregate sorts and spills them for the merge
replay, and a partial-reduce aggregate emits them.
Tests: SELECT DISTINCT over 3 GiB of distinct 1 MiB keys in a partial and a
final aggregate on (Int32, Utf8) and a partial on Utf8 alone failed with the
production error (and the ArrowBytesMap panic) and now return every group.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
0 commit comments