Skip to content

fix(merge_insert): project unindexed fragments to the source's nested subset - #11314

Merged
wjones127 merged 1 commit into
lance-format:mainfrom
deeps1991:deepthisrinivasan/oss-2651-indexed-merge-insert-nested-subset
Nov 23, 2026
Merged

wjones127 merged 1 commit into
lance-format:mainfrom
deeps1991:deepthisrinivasan/oss-2651-indexed-merge-insert-nested-subset

Conversation

@deeps1991

Copy link
Copy Markdown
Contributor

Summary

An indexed merge_insert whose source carries a subset of a nested
struct's children failed when the table also had fragments the index
does not cover. The indexed take narrowed the struct to the source's
children, but the scan of unindexed fragments read the full struct, so
the UnionExec combining them rejected the mismatched types (a panic on
DataFusion 54, a plan error on 55).

The fallback scan now uses the same projection as the take.

Tests

test_indexed_partial_update_if_nested_subset_unindexed_fragment: a
table with cells: list<struct<idx, timestamp, data>>, an index over
one fragment and an appended unindexed fragment, and a source supplying
only idx and data. It checks that both keys are updated, that the
unsupplied timestamp child is preserved, and that the update_if
condition evaluates on the row from the unindexed scan. The test fails
without the fix with the UnionExec error.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the bug Something isn't working label Nov 20, 2026
@deeps1991
deeps1991 marked this pull request as ready for review November 20, 2026 13:50

@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.

@deeps1991
deeps1991 marked this pull request as draft November 20, 2026 13:50

@wjones127 wjones127 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.

Thanks, this is a clean fix. Reusing the take's Projection for the fallback scan means the two sides of the UnionExec can't drift apart.

One optional suggestion on the new test's update_if condition.

… subset

An indexed merge_insert unions the indexed take with a scan of the
fragments the index does not cover (and of overlay-stale rows). The take
projects the target through a Lance `Projection` built from the source
schema, so a source whose `cells` carries only some of a struct's
children narrows `cells` to those children. The fallback scan projected
by top-level column names instead, which reads the full nested type.
`UnionExec` then rejected the mismatched types ("requires all inputs to
have the same data type per column"); on older DataFusion versions this
was a panic.

Project the fallback scan with the same projection's schema so both
inputs emit identical types.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@deeps1991
deeps1991 force-pushed the deepthisrinivasan/oss-2651-indexed-merge-insert-nested-subset branch from d3c8660 to 2837cc9 Compare November 23, 2026 16:56
@deeps1991
deeps1991 marked this pull request as ready for review November 23, 2026 17:45

@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.

@wjones127
wjones127 merged commit 6336d04 into lance-format:main Nov 23, 2026
41 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants