Skip to content

fix(scanner): materialize list columns late as a unit - #9148

Merged
yanghua merged 1 commit into
lance-format:mainfrom
zhangyue19921010:fix/late-materialize-list-as-unit
Sep 20, 2026
Merged

yanghua merged 1 commit into
lance-format:mainfrom
zhangyue19921010:fix/late-materialize-list-as-unit

Conversation

@zhangyue19921010

Copy link
Copy Markdown
Collaborator

The late-materialization heuristic decided eager/late per field. A list's item child is narrow, so it stayed eager and pulled the whole list back into the eager projection even though the list itself was judged late.

Decide the list (and any other non-struct nested field) as one unit: once a non-struct field is late, all of its descendants are late too. Struct children are still decided individually so a narrow sibling stays eager.

The late-materialization heuristic decided eager/late per field. A list's
`item` child is narrow, so it stayed eager and pulled the whole list back
into the eager projection even though the list itself was judged late.

Decide the list (and any other non-struct nested field) as one unit: once
a non-struct field is late, all of its descendants are late too. Struct
children are still decided individually so a narrow sibling stays eager.
@github-actions github-actions Bot added the bug Something isn't working label Sep 11, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Gate recommendation: approve.

The scanner now carries a late decision through non-struct descendants, so a narrow list item can no longer pull the list payload into the eager read. Struct children remain independently planned, preserving the intended sibling optimization.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 11, 2026

@yanghua yanghua left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yanghua
yanghua merged commit e6a3e8f into lance-format:main Sep 20, 2026
38 checks passed
meta-codesync Bot pushed a commit to meta/sapling that referenced this pull request Oct 5, 2026
Summary:
Upgrading `lancedb` from `0.37.1-beta.1` to `0.40.0-beta.12` (git rev `3d8c9e2ddc61ce819f42bd56c4b56ee0fd4ae769`), and the lance crate family from `11.0.0-beta.3` to `13.1.0-beta.1` (github.com/fbsource/lance `e5a3553b1699a7062ff7afe4ee268d596bbf2e0d`, tag v13.1.0-beta.1).
- Purpose: pulls in lance-format/lance#9148 (`e6a3e8f3d099`), which stops an unindexed filtered scan from eagerly decoding `List<Float32>` columns for every row of every fragment. Verified with a model-free lancedb repro (12 fragments x 8 rows x 4 KiB `List<Float32>`, filter `id IN (...)`): the filter-phase scan now projects `[id, n_tokens, token_dim]` with bytes_read 50.54 K, and `flat_vector` is taken late for the 3 matching rows only (12.53 K). On 11.0.0-beta.3 the filter phase projected `flat_vector` too and read 447.6 K.
- All 21 `[patch."https://github.com/lance-format/lance.git"]` entries moved to the new rev; autocargo regenerated the mirrored patch sections.
- New overlay `third-party/rust/fixups/lancedb/overlay/src/job.rs`: the vendored `job.rs` with exactly the hunks of upstream lancedb/lancedb#4233 (head `8d11d4ab649fb5634ad53d936c84db79aebb96cf`, still open) applied, fixing lancedb/lancedb#4142. lancedb >= 0.38 does not compile without its `remote` feature (`job.rs` constructs the `remote`-gated `Error::Http`); fbsource enables only `sentence-transformers`. Scoped to `=0.40.0-beta.12`; delete when the pinned lancedb contains #4233.
- `third-party/rust/fixups/lance-linalg`: compile the new AMX-FP16 kernel `src/simd/amx_fp16.c` as a `cxx_library` on x86_64 Linux with the build script's flags (same pattern as the existing `dist_table.c` entry). The build script sets `kernel_support="amx_fp16"`, but Buck2 does not link its cc output, which left `lance_amx_*` undefined at link time.
- `third-party/rust/fixups/lancedb`: async-trait `narrow_to` version selector moved to the new version (upstream still declares `async-trait = "0"`).
- Transitive: `lance-namespace-reqwest-client` 0.8.6 -> 0.13.0; `object_store` 0.14.2 added alongside 0.12.5/0.13.2. No other Cargo.lock changes.
- Reviewer note: on AMX-FP16 hosts (Granite Rapids+), lance 13 routes f16 dot products and IVF partition assignment through the AMX kernel, chosen at runtime via CPUID; `LANCE_DISABLE_AMX=1` restores the previous path.
- No fbcode fixes needed. All 144 Rust targets that transitively depend on `fbsource//third-party/rust:lancedb` were checked with arc rust-check: Bindle (99 targets) has 0 errors. semcode, perf_mcp and fbcode/scripts/czakian/pear fail with the same errors before and after this diff (pre-existing: fbsource `arrow` 57 vs lancedb's arrow 58.4.0, which is unchanged here; the `Table::add_columns` builder API; unrelated tree-sitter-python and sha2 breaks; pear has no sources).
- Bindle model-free ranking tests pass (27/27). Bindle lance storage tests show no regression against the base revision: the failures seen (ASAN stack overflows in checkpoint_integration_test, DeltaSealInProgress, a peak-RSS budget, a lease-transfer timeout, and a deprecated-API build failure in lancedb_multi_writer_test) all reproduce at base, where they are as frequent or more frequent.

Reviewed By: dtolnay

Differential Revision: D123262780

fbshipit-source-id: 2cc9059dbbe36b4cc691ffeaed786f31d16f0446
meta-codesync Bot pushed a commit to facebookexperimental/rust-shed that referenced this pull request Oct 5, 2026
Summary:
Upgrading `lancedb` from `0.37.1-beta.1` to `0.40.0-beta.12` (git rev `3d8c9e2ddc61ce819f42bd56c4b56ee0fd4ae769`), and the lance crate family from `11.0.0-beta.3` to `13.1.0-beta.1` (github.com/fbsource/lance `e5a3553b1699a7062ff7afe4ee268d596bbf2e0d`, tag v13.1.0-beta.1).
- Purpose: pulls in lance-format/lance#9148 (`e6a3e8f3d099`), which stops an unindexed filtered scan from eagerly decoding `List<Float32>` columns for every row of every fragment. Verified with a model-free lancedb repro (12 fragments x 8 rows x 4 KiB `List<Float32>`, filter `id IN (...)`): the filter-phase scan now projects `[id, n_tokens, token_dim]` with bytes_read 50.54 K, and `flat_vector` is taken late for the 3 matching rows only (12.53 K). On 11.0.0-beta.3 the filter phase projected `flat_vector` too and read 447.6 K.
- All 21 `[patch."https://github.com/lance-format/lance.git"]` entries moved to the new rev; autocargo regenerated the mirrored patch sections.
- New overlay `third-party/rust/fixups/lancedb/overlay/src/job.rs`: the vendored `job.rs` with exactly the hunks of upstream lancedb/lancedb#4233 (head `8d11d4ab649fb5634ad53d936c84db79aebb96cf`, still open) applied, fixing lancedb/lancedb#4142. lancedb >= 0.38 does not compile without its `remote` feature (`job.rs` constructs the `remote`-gated `Error::Http`); fbsource enables only `sentence-transformers`. Scoped to `=0.40.0-beta.12`; delete when the pinned lancedb contains #4233.
- `third-party/rust/fixups/lance-linalg`: compile the new AMX-FP16 kernel `src/simd/amx_fp16.c` as a `cxx_library` on x86_64 Linux with the build script's flags (same pattern as the existing `dist_table.c` entry). The build script sets `kernel_support="amx_fp16"`, but Buck2 does not link its cc output, which left `lance_amx_*` undefined at link time.
- `third-party/rust/fixups/lancedb`: async-trait `narrow_to` version selector moved to the new version (upstream still declares `async-trait = "0"`).
- Transitive: `lance-namespace-reqwest-client` 0.8.6 -> 0.13.0; `object_store` 0.14.2 added alongside 0.12.5/0.13.2. No other Cargo.lock changes.
- Reviewer note: on AMX-FP16 hosts (Granite Rapids+), lance 13 routes f16 dot products and IVF partition assignment through the AMX kernel, chosen at runtime via CPUID; `LANCE_DISABLE_AMX=1` restores the previous path.
- No fbcode fixes needed. All 144 Rust targets that transitively depend on `fbsource//third-party/rust:lancedb` were checked with arc rust-check: Bindle (99 targets) has 0 errors. semcode, perf_mcp and fbcode/scripts/czakian/pear fail with the same errors before and after this diff (pre-existing: fbsource `arrow` 57 vs lancedb's arrow 58.4.0, which is unchanged here; the `Table::add_columns` builder API; unrelated tree-sitter-python and sha2 breaks; pear has no sources).
- Bindle model-free ranking tests pass (27/27). Bindle lance storage tests show no regression against the base revision: the failures seen (ASAN stack overflows in checkpoint_integration_test, DeltaSealInProgress, a peak-RSS budget, a lease-transfer timeout, and a deprecated-API build failure in lancedb_multi_writer_test) all reproduce at base, where they are as frequent or more frequent.

Reviewed By: dtolnay

Differential Revision: D123262780

fbshipit-source-id: 2cc9059dbbe36b4cc691ffeaed786f31d16f0446
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants