Tracking Issue: Implement `ListPack` in V2 Scan Engine

Ouverte
#11,855 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
8/100
Type d'issue
Fonctionnalité
Clarté
À clarifier
Activité
Active
Stack technique
rust
Domaine
data

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
Rust
Étoiles
3.2k
Forks
239
Merge moyen
1 j 4 h
PR mergées (30 j)
684

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de vortex-data/vortex

Toutes les issues de vortex-data/vortex

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.