Skip to content

fix(python): preserve Arrow schema when merging reranker scores - #4332

Merged
Xuanwo merged 1 commit into
lancedb:mainfrom
LindseyZ1205:fix/reranker-preserve-arrow-schema
Oct 22, 2026
Merged

Xuanwo merged 1 commit into
lancedb:mainfrom
LindseyZ1205:fix/reranker-preserve-arrow-schema

Conversation

@LindseyZ1205

Copy link
Copy Markdown

Fixes #4331

With return_score="all", model rerankers reconstruct merged rows without their Arrow schema. This changes fixed-size float32 vectors into variable-length float64 lists, loses metadata, and can overflow valid uint64 row IDs.

Unify the original input schemas before inserting placeholder scores, then use the unified schema when reconstructing the merged table. Row merging and reranking behavior stay the same. Capturing the schema first also preserves float64 scores without conflicting with the float32 null placeholders.

Validation:

  • New regression cases: 5 failures and 5 passing controls before the fix; all 10 pass afterward.
  • Reranker, hybrid-query and TypeSafe reranker tests: 150 passed, 17 skipped. Optional live model/API tests were not run.
  • The fake-client tests that use random metadata passed again with seeds 7 and 41.
  • Repository-wide Ruff lint/format checks, configured Pyright check and applicable pre-commit hooks pass.
  • Tests used the locally built Rust/Python extension and the repository's locked uv environment. No Rust code changed.

AI disclosure: I used Codex for investigation, implementation, tests, local checks, and drafting this description.

@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 pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added bug Something isn't working Python Python SDK labels Sep 27, 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 fixes the all-score reranker schema loss at the Arrow table reconstruction boundary. Capturing the unified input schema before adding placeholder scores preserves row IDs, fixed-size vectors, metadata, and original score types while keeping the existing merge behavior. The regression tests cover high row IDs, score types, both score modes, and empty input; I found no acceptance blocker.

@lancedb-gatekeeper lancedb-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 27, 2026
@Xuanwo
Xuanwo merged commit 55897d7 into lancedb:main Oct 22, 2026
4 checks passed
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): all-score rerankers lose the input Arrow schema

2 participants