Tracking Issue: Implement `ListPack` in V2 Scan Engine

未關閉
#11,855 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
8/100
Issue 類型
功能
描述清晰度
需要釐清
活躍度
活躍
技術堆疊
rust
領域
data

研究方向

This is a design tracking issue, not a bounded task. Start by reading the existing ListReader in the V1 scan path and comparing it with the planned ListPack port for the V2 scan engine. The issue leaves open whether to use an element-domain index in layout metadata or runtime plan compilation, so the design must be settled first. Done means ListLayout reads on V2 with no regression against V1 on the PolarSignals and Statpopgen benchmarks.

由索引模型根據 Issue 內容生成。

描述

tracking-issue

This is a tracking issue for implementing ListPack in the V2 Scan engine, which allows for reading from ListLayout.

Motivation

Currently the V2 Scan engine cannot read from ListLayout. Benchmarks that use V2 Scan do not have ListLayout enabled in the edition they use. Benchmarks that write and read ListLayout, including PolarSignals and Statpopgen, use the v1 scan engine.

The goal is to move these two onto the V2 scan with no regression against V1.

Problem

There is no straightforward port of ListReader to ListPack, because reading the elements child is currently dependent on first reading the offsets child to determine the corresponding row range in the elements row domain.

Handed a row range that covers the entire list and an all-true mask, ListReader will fetch the offsets and elements in parallel. In general though, the requested row range is narrower than the length of the layout and/or the mask filters out some lists. A scans splits are typically narrower than the layout even when nothing is filtered. This is the case ListLayout, which shreds offsets and elements into children with separate layouts, was designed for. A sparse or bounded read only fetches the subset of the elements child it needs, and skips IO and compute over elements it doesn't need.

For such a read,ListReader first fetches and decodes the offsets child, indexes into them to find the element ranges it needs, and only asks the element reader for those rows (with the mask expanded to element row domain).

This costs a sequential read (or potentially several, for deeply nested lists), but the benchmarks show that this cost is offset by the IO/compute savings. A potential optimization that has been discussed is adding an index for the outer row domain (offsets) -> inner row domain (elements) mapping, stored as metadata in either the list layout metadata or in another segment near the footer. This would allow fetching offsets and elements in parallel, at the cost of overreading elements and larger file size.

The main issue with integrating the current system into the Scan V2 engine is that planning happens before execution. It is not currently possible to plan the offsets read, read the offsets data, and then plan and execute the list elements read. Plans must be compiled statically during the filter or projection phase with a row range and corresponding mask, so the row range of one compiled plan cannot be determined by reading the data fetched by another plan.

Design

There are two proposed approaches to adding support for reading ListLayout. They are not mutually exclusive.

Element Domain Index

Record the (outer) row index of each stride-th element row in layout metadata (or in another segment near the footer). The indices can be heavily compressed (perhaps with delta + bitpack) since they are monotonically increasing. Since metadata is read at planning time, we can translate the (outer) row domain into element domain without reading the offsets.

This also has the benefit of removing the sequential dependency between offsets and elements, which leads to multiple rounds of IO for nested lists (and worse coalescing). There would be one round of IO regardless of nesting depth.

However, the index may also bloat footer size and will always lead to overreading element rows (but this is bounded up to stride - 1 elements). Nested lists will compound the latter problem.

Allow Plan Compilation during Runtime

This mirrors what is currently done in ListReader.

A running source queues a compile over rows it computed. The scan carries it out after that run, into ordinary pipelines writing a new inlet of the source, so only the scan rewires the graph and only between runs; the new pipelines share its scheduler, reads and value cache. A compile selecting nothing yields a closed inlet and wakes the source.

ListPack::compile compiles the offsets and validity of the selected lists and joins them with a ListSource. Once both inlets close, the source computes the element ranges of the selected non-null lists from the stored offsets, merges adjacent ranges, builds a mask over first..last element, and calls cx.compile(elements, range, mask). When that inlet closes it joins the elements and emits the lists. This would cost one extra round of IO per nesting level.

Steps

Unresolved questions

Implementation history

主要語言
Rust
星號
3.2k
分支
239
平均合併
1 天 4 小時
30 天內合併 PR
684

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

vortex-data/vortex 的其他 Issue

查看 vortex-data/vortex 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。