Skip to content

Random access with filter (in Python) #3460

Answered by westonpace
pimdh asked this question in Q&A
Discussion options

You must be logged in to vote

Are there better ways of doing this? I can create a lance index on the tag column, but I can't find the Python API to access the index to accommodate this use-case.

There are no better ways available in the current code. If you create a bitmap index on the tag column we are essentially creating the exact same lookup you describe (a map from every tag to a list of row ids) but there are no APIs in place today to access the index values directly.

So the best you can do, once you create the index, is to first query for all matching row ids (filter="tag=X", with_row_id=True) and then sample from the set of row ids that you get back and call _take_rows.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pimdh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants