Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delta indices have wrong fragment bitmap #3374

Open
wjones127 opened this issue Jan 13, 2025 · 1 comment · May be fixed by #3377
Open

Delta indices have wrong fragment bitmap #3374

wjones127 opened this issue Jan 13, 2025 · 1 comment · May be fixed by #3377
Assignees
Labels
bug Something isn't working

Comments

@wjones127
Copy link
Contributor

Creating a delta index produces overlapping fragment bitmaps. It's not obvious whether this is just a bug in metadata, or it's actually not producing a correct delta.

import lance
import pyarrow as pa
import pyarrow.compute as pc

assert lance.__version__ == '0.21.0'

data = pa.table({
    'vector': pa.FixedSizeListArray.from_arrays(
        pc.random(32 * 1024).cast(pa.float32()),
        32
    )
})
ds = lance.write_dataset(data, 'memory://')
ds.create_index('vector', index_type="IVF_PQ", num_partitions=1, num_sub_vectors=2)
ds.list_indices()
[{'name': 'vector_idx',
  'type': 'IVF_PQ',
  'uuid': '2e67e9ed-3bae-44a0-bf91-7b2a08ab7aff',
  'fields': ['vector'],
  'version': 1,
  'fragment_ids': {0}}]
data2 = pa.table({
    'vector': pa.FixedSizeListArray.from_arrays(
        pc.random(32 * 1024).cast(pa.float32()),
        32
    )
})
ds.insert(data2)
ds.optimize.optimize_indices(num_indices_to_merge=0)
ds.list_indices()
[{'name': 'vector_idx',
  'type': 'IVF_PQ',
  'uuid': '2e67e9ed-3bae-44a0-bf91-7b2a08ab7aff',
  'fields': ['vector'],
  'version': 1,
  'fragment_ids': {0}},
 {'name': 'vector_idx',
  'type': 'IVF_PQ',
  'uuid': '6d711d5f-30d8-40b9-afb5-ec869fa92be9',
  'fields': ['vector'],
  'version': 3,
  'fragment_ids': {0, 1}}]
@wjones127 wjones127 added the bug Something isn't working label Jan 13, 2025
@wjones127
Copy link
Contributor Author

Based on the size of the index file, it does seem to be producing a delta. I think it's just not the correct metadata.

drwxr-xr-x@    - willjones 13 Jan 10:07 size_test
drwxr-xr-x@    - willjones 13 Jan 10:07 ├── _indices
drwxr-xr-x@    - willjones 13 Jan 10:07 │  ├── 885aba37-3094-42d9-9da1-2288818318f7
.rw-r--r--@  43k willjones 13 Jan 10:07 │  │  └── index.idx
drwxr-xr-x@    - willjones 13 Jan 10:07 │  └── a623ebb3-3070-4262-ba78-bc9104e83eba
.rw-r--r--@  43k willjones 13 Jan 10:07 │     └── index.idx

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 a pull request may close this issue.

1 participant