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

No matter what index type I specify, it is always listed as IVF_PQ. #3245

Closed
benmayersohn opened this issue Dec 14, 2024 · 2 comments · Fixed by #3258
Closed

No matter what index type I specify, it is always listed as IVF_PQ. #3245

benmayersohn opened this issue Dec 14, 2024 · 2 comments · Fixed by #3258
Assignees
Labels
bug Something isn't working rust Rust related tasks

Comments

@benmayersohn
Copy link

I've tried creating a IVF_HNSW_SQ index on a dataset that has a vector column called embedding, but it seems the index type is always listed as IVF_PQ no matter what.

Here's a reproducible example. I use lancedb here but I extract the underlying lance dataset right away and create the index on that, so I don't think it's a lancedb issue:

import polars as pl
import numpy as np
from lancedb.db import LanceDBConnection

df = pl.DataFrame({
    'product_id': np.arange(1000),
    'embedding': np.random.rand(1000, 512).astype(np.float32)
    },
    schema_overrides={
        "embedding": pl.Array(inner=pl.Float32, shape=(512,)),
    },
)

db_test = LanceDBConnection('test.lancedb')

db_test.create_table('test_table', df, mode='overwrite')
table_test = db_test['test_table']
dataset_test = table_test.to_lance()

dataset_test.create_index(
    'embedding',
    'IVF_HNSW_SQ',
    metric='cosine',
    num_partitions=16,
    replace=True,
    ef_construction=100,
    M=48,
    max_levels=4
)

dataset_test.list_indices()

# This is my output
# [{'name': 'embedding_idx', 'type': 'IVF_PQ', 'uuid': '32acea8a-b94b-4578-a698-0950facdcf84', 'fields': ['embedding'], 'version': 10, 'fragment_ids': {0}}]

Versions of packages I'm using in this example with Python 3.10:

lancedb==0.17.0
pylance==0.20.0
polars==1.17.0
numpy==1.26.4

Any suggestions would be appreciated. Thanks!

@BubbleCal
Copy link
Contributor

hi @benmayersohn
it's a bug, that the list_indices would always report the vector index type is IVF_PQ even it's not.
just filed a fix #3258

@benmayersohn
Copy link
Author

Thanks so much @BubbleCal!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rust Rust related tasks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants