lance-format / lance-format/lance

bug: Project leaves overlays behind for the columns it drops

Open Beginner friendly
#9,313 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
7.1k
Forks
852
Avg merge
3d 18h
Merged PRs (30d)
272

Description

Dropping a column with Operation::Project prunes the data files whose fields all went away, but leaves the fragment's overlays untouched. A fragment can therefore come out of a projection carrying a DataOverlayFile that supplies only field ids the manifest schema no longer contains.

No concurrency is involved — a plain overlay commit followed by a plain projection reproduces it.

Repro

On a dataset with columns a, b, c, d:

  1. Commit a DataOverlay supplying new values for c on fragment 0.
  2. Commit a Project to ["a", "b", "d"].

The resulting manifest has fragment 0 with overlays = [<file supplying field 2>], while the schema field ids are {0, 1, 3}. Field 2 is gone, so nothing will ever read that overlay, and cleanup has no reason to believe the file is dead.

Cause

Operation::Project's arm in rust/lance-table/src/transaction/manifest_build.rs:924 computes remaining_field_ids from the projected schema and retains only the data files with a surviving field:

for fragment in final_fragments.iter_mut() {
    fragment.files.retain(|file| {
        file.fields
            .iter()
            .any(|field_id| remaining_field_ids.contains(field_id))
    });
}

fragment.overlays gets the same treatment nowhere. The Merge arm above it has the same shape and the same gap.

Expected

An overlay whose field ids are all absent from the projected schema should be dropped alongside the data files, by the same remaining_field_ids rule. An overlay that still supplies at least one live field should be kept.

Found by

The legacy conflict-resolution characterization suite in #9220, which asserts that every overlay on a committed manifest supplies at least one field that is in the schema.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in rust/lance-table/src/transaction/manifest_build.rs around the Operation::Project arm at line 924, then compare it with the Merge arm above. Reproduce the overlay-then-project sequence described in the issue and inspect the legacy conflict-resolution characterization suite from #9220. Done means projected manifests drop overlays with no surviving field ids while retaining overlays that still supply a live field.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data-engineering
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.