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 摘要。