merge_insert RewriteColumns lists the join key in fields_modified, withdrawing exact index coverage over the key

オープン
#10,781 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
databases

調査の方向性

Start by reading select_write_sink and its comment, then trace how MergeInsertWriteMode::RewriteColumns populates Operation::Update::fields_modified and how Transaction::prepare_indices handles rewritten_physical_columns and withdraw_in_place_rewrites. Reproduce the behavior with a BTREE index on the join key and inspect the fragment bitmap after commit. Done when a matched-row rewrite preserves exact index coverage, with tests confirming the behavior.

索引モデルが issue の本文から書いたものです。

説明

Summary

A merge_insert with MergeInsertWriteMode::RewriteColumns writes the join key into the patch data file and lists the key's field id in Operation::Update::fields_modified. Transaction::prepare_indices (through rewritten_physical_columns and withdraw_in_place_rewrites) then withdraws every touched fragment from every index over the key. The key values are byte-identical to the stored ones, because the join matched them exactly, and a column patch moves no row, so each row keeps its stable row id. The withdrawn coverage was exact.

The doc comment in select_write_sink already describes this cost ("the patch would reproduce the key column byte for byte, and still cost a full-fragment column file plus the invalidation of every index over the key").

Reproduction (Lance 13.0.0)
  1. Create a dataset with stable row ids: id: Utf8 (the join key) with a BTREE index, score: Int32, plus any other columns.
  2. Stage MergeInsertBuilder::try_new(ds, ["id"]), when_matched(UpdateAll), when_not_matched(DoNothing), write_mode(RewriteColumns), with a source of (id, score) that matches some rows.
  3. Observe that fields_modified contains the field id of id, and that after commit the id index's fragment_bitmap no longer contains the touched fragment.

Removing the key's field id from fields_modified before commit keeps the coverage. Equality lookups on the key then return every row exactly once, with the patched values.

Expected

For RewriteColumns, either do not list the join key in fields_modified, or omit the key from the patch file. Both are correct because the key values cannot change in a matched-row update. The second also saves writing a full-fragment copy of the key column.

Context

Omnigraph stages column patches for narrow updates of wide rows and currently removes the key from fields_modified itself, pinned by a surface test: https://github.com/ModernRelay/omnigraph/pull/1272. An upstream fix would let that adapter go.

主要言語
Rust
スター
7.3k
フォーク
929
平均マージ
2日 22時間
マージ済み PR(30日)
572

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

lance-format/lance のほかの issue

lance-format/lance の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。