Skip to content

fix(python): preserve repeated indexed merge inserts - #3850

Merged
Xuanwo merged 1 commit into
mainfrom
gatekeeper/fix-3280-1
Aug 6, 2026
Merged

Xuanwo merged 1 commit into
mainfrom
gatekeeper/fix-3280-1

Conversation

@lancedb-gatefixer

Copy link
Copy Markdown
Contributor

Summary

  • add a Python regression test for two partial-schema merge inserts against the same BTree-indexed rows
  • verify repeated updates retain one copy of every row and the final update values

Root cause

Lance 4.0, used by LanceDB 0.30.2, removed a rewritten fragment from the index bitmap while stale BTree entries for that fragment remained searchable. The next merge found each target through both the stale index and the unindexed-fragment scan, producing the ambiguous-match error. Lance fixed the root cause in lance-format/lance#6563 by applying the fragment-bitmap allow-list to index results, and the Lance release pinned by current LanceDB includes that fix. This test preserves the corrected behavior through the Python API.

Validation

  • cd python && uv run --extra tests pytest python/tests/test_table.py -k merge_insert -q (9 passed)
  • cd python && uv run --extra tests --extra dev ruff format --check python/tests/test_table.py
  • cd python && uv run --extra tests --extra dev ruff check python/tests/test_table.py

Repository-wide Ruff also reports 20 pre-existing violations in untouched CI and plugin scripts.

Fixes #3280

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@github-actions github-actions Bot added bug Something isn't working Python Python SDK labels Aug 6, 2026

@lancedb-gatekeeper lancedb-gatekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Gate recommendation: approve.

This adds the regression at the right integration boundary: the public Python API now covers repeated partial-schema merge updates over BTree-indexed rows and verifies update counts, row cardinality, and final values. It mirrors the stale-index fragment scenario fixed in the pinned Lance revision.

@Xuanwo
Xuanwo merged commit c1a3fa7 into main Aug 6, 2026
17 checks passed
@Xuanwo
Xuanwo deleted the gatekeeper/fix-3280-1 branch August 6, 2026 08:48
@Xuanwo Xuanwo added the K-approved Latest Gatekeeper recommendation permits acceptance. label Aug 10, 2026
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. Python Python SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(python): After building the index, executing create_scalar_index multiple times with merge_insert will result in an error.

1 participant