Expand description
Splits a cached combined-geometry Parquet blob back into the per-batch
chunks a live parse would have streamed, so a cache hit on
POST /api/v1/parse/parquet-stream can replay the same Start / Batch+
Progress / Complete event shape as a miss (issue #3895) instead of one
oversized Batch.
StreamingParquetCacheWriter (parquet.rs) appends one Parquet row group
per live stream batch to each of the three section tables (mesh / vertex /
index) — an invariant that writer pins by disabling the row-count-driven
row-group split. This module reads those boundaries back out: the
vertex/index tables are already batch-local (no offset is baked into their
columns), and the mesh table’s vertex_start / index_start columns are
re-based from whole-model globals back to batch-local zero, so the
re-encoded per-batch blob matches what the live per-batch serializer
(serialize_to_parquet, base offsets 0/0) would have produced for that
same batch.
A cross-batch client (stream_shapes=cross-batch, #5407) gets each batch
as written instead, whole-stream offsets and all, with its bases stated
beside it: split_into_stream_batches. A blob a cross-batch
stream wrote cannot be re-based batch-locally at all, since its rows point
into earlier row groups, so split_into_batches refuses it and a
batch-local client is replayed the whole blob as one batch, which decodes
correctly, only not progressively.
Structs§
- Replay
Batch - One reconstructed batch, ready to base64-encode into a
BatchSSE event. - Section 🔒
- One Parquet section of the cached blob, with its footer parsed ONCE.
Re-opening a
ParquetRecordBatchReaderBuilderper row group re-parses the whole footer each time, which is quadratic in the row-group count — hundreds of milliseconds on a model that streamed a few hundred batches.
Functions§
- column_
sum 🔒 - Sum a non-nullable
UInt32mesh column, dividing each value byper_rowfirst. The division is PER ROW, not on the total, becausebuild_mesh_tablescounts index-table rows the same way — one row perindices.len() / 3per mesh, so a mesh whose index count is not a multiple of 3 rounds down on its own, not against its neighbours. - encode_
batch 🔒 - furthest_
range_ 🔒end - The furthest
start + countany row ofrbnames (0 for no rows).Nonewhen either column is missing or notUInt32. - localize_
mesh_ 🔒batch - Re-base a mesh-table row group’s
vertex_start/index_startcolumns from whole-model globals back to batch-local zero, by subtracting the group’s own first-row values — the exact base offsetStreamingParquetCacheWriter::appendfed intobuild_mesh_tablesfor that batch. Every other column is untouched. Columns are resolved BY NAME, so a schema reorder can never silently re-base the wrong one. - rebase_
to_ 🔒zero - Subtract a
UInt32column’s first value from every value.checked_subrather than-: on a foreign blob whose offsets are not non-decreasing this would panic in debug and, with the release profile’soverflow-checks = false, WRAP to a ~4-billion offset that decodes as valid geometry.Noneinstead sends the caller to its fallback. - split_
geometry_ 🔒sections - Split the triple-framed
[mesh_len][mesh][vertex_len][vertex][index_len] [index]geometry blob into its three sections.Noneon any short or mismatched-length framing, or trailing bytes past the third section. - split_
into_ batches - Split a cached geometry blob (the inner section framing
cached_geometry_slicereturns) back into per-original-batch chunks. - split_
into_ stream_ batches - Split a cached geometry blob into its batches for a CROSS-BATCH client (#5407): each batch keeps its whole-stream offsets and states the bases its vertex and index tables start at, exactly as the live cross-batch stream does. Works on a blob either kind of stream wrote, because a batch-local stream’s cache rows are whole-stream too and simply never point backwards.
- take_
length_ 🔒prefixed