Tracking Issue: Implement `ListPack` in V2 Scan Engine

Aperta
#11,855 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
8/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
data

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Rust
Stelle
3.2k
Fork
239
Merge medio
1g 4h
PR unite (30g)
684

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vortex-data/vortex

Tutte le issue di vortex-data/vortex

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.