-
Notifications
You must be signed in to change notification settings - Fork 212
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
fix: respect storage options on create_index
#2460
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the PR. This method is indeed flawed, but I think there is a more sensible solution.
python/python/lance/dataset.py
Outdated
return LanceDataset(self.uri, index_cache_size=index_cache_size) | ||
|
||
storage_options = None | ||
if "storage_options" in kwargs: | ||
storage_options = kwargs.pop("storage_options") | ||
|
||
return LanceDataset(self.uri, index_cache_size=index_cache_size, storage_options=storage_options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._ds.create_index()
just updates self here:
Lines 928 to 934 in 8746737
let mut new_self = self.ds.as_ref().clone(); | |
RT.block_on( | |
None, | |
new_self.create_index(&columns, idx_type, name, params.as_ref(), replace), | |
)? | |
.map_err(|err| PyIOError::new_err(err.to_string()))?; | |
self.ds = Arc::new(new_self); |
So, we might as well do return self
instead. The current code re-opens the dataset, but there's no good reason we can't re-use the instance given we are already mutating it. This will make the index_cache_size
parameter un-used, but I think we can just deprecate it in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree - I find it pretty weird there is a recreation in the first place
from an end-user perspective the current implementation is a blocker for usage of indices in meaningful fashions (not just local fs) so the "dirty" fix was implemented. since the set_index
method is featured in the readme, should at least function with all object storages though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the current implementation is a blocker for usage of indices
Why is this? Why can't you just use the original dataset?
ds = lance.write_dataset(...)
ds.create_index(...) # ignore return value
# use ds now?
no prob, happy to contribute to such an interesting project agree completely, i view this as a pretty "dirty" fix created with the intent to patch the functionality until further review of process is implemented. would be ideal to just reuse the current instances and retain the current object store, since object storage should be static anyways relative to object instantiation at runtime |
Co-authored-by: Will Jones <willjones127@gmail.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [lance](https://togithub.com/lancedb/lance) | dependencies | patch | `0.12.1` -> `0.12.2` | --- ### Release Notes <details> <summary>lancedb/lance (lance)</summary> ### [`v0.12.2`](https://togithub.com/lancedb/lance/releases/tag/v0.12.2) [Compare Source](https://togithub.com/lancedb/lance/compare/v0.12.1...v0.12.2) <!-- Release notes generated using configuration in .github/release.yml at v0.12.2 --> #### What's Changed ##### New Features 🎉 - feat: support IVF_FLAT index by [@​BubbleCal](https://togithub.com/BubbleCal) in [https://github.com/lancedb/lance/pull/2418](https://togithub.com/lancedb/lance/pull/2418) - feat: add support for arbitrary global buffers to the v2 reader/writer by [@​westonpace](https://togithub.com/westonpace) in [https://github.com/lancedb/lance/pull/2445](https://togithub.com/lancedb/lance/pull/2445) - feat: add pushdown to the read path by [@​westonpace](https://togithub.com/westonpace) in [https://github.com/lancedb/lance/pull/2444](https://togithub.com/lancedb/lance/pull/2444) - feat: scan with stable row id by [@​wjones127](https://togithub.com/wjones127) in [https://github.com/lancedb/lance/pull/2441](https://togithub.com/lancedb/lance/pull/2441) - feat(java): add lance spark connector for read by [@​LuQQiu](https://togithub.com/LuQQiu) in [https://github.com/lancedb/lance/pull/2429](https://togithub.com/lancedb/lance/pull/2429) - feat: pickle the manifest when pickling a dataset by [@​westonpace](https://togithub.com/westonpace) in [https://github.com/lancedb/lance/pull/2459](https://togithub.com/lancedb/lance/pull/2459) - feat: store IVF in global buffer by [@​BubbleCal](https://togithub.com/BubbleCal) in [https://github.com/lancedb/lance/pull/2449](https://togithub.com/lancedb/lance/pull/2449) ##### Bug Fixes 🐛 - fix: lance.torch.LanceDataset spelt readahead wrong by [@​wjones127](https://togithub.com/wjones127) in [https://github.com/lancedb/lance/pull/2453](https://togithub.com/lancedb/lance/pull/2453) - fix: respect storage options on `create_index` by [@​joshua-auchincloss](https://togithub.com/joshua-auchincloss) in [https://github.com/lancedb/lance/pull/2460](https://togithub.com/lancedb/lance/pull/2460) - fix: incorrect logic when decoding manifest from last block by [@​westonpace](https://togithub.com/westonpace) in [https://github.com/lancedb/lance/pull/2464](https://togithub.com/lancedb/lance/pull/2464) ##### Documentation 📚 - docs: add spark-lance-connector readme by [@​LuQQiu](https://togithub.com/LuQQiu) in [https://github.com/lancedb/lance/pull/2456](https://togithub.com/lancedb/lance/pull/2456) ##### Performance Improvements 🚀 - perf: speed up hnsw build by [@​eddyxu](https://togithub.com/eddyxu) in [https://github.com/lancedb/lance/pull/2448](https://togithub.com/lancedb/lance/pull/2448) - perf: better L2 code generation by [@​eddyxu](https://togithub.com/eddyxu) in [https://github.com/lancedb/lance/pull/2450](https://togithub.com/lancedb/lance/pull/2450) ##### Other Changes - refactor: pull row_id and deletion vector out of v1 file reader by [@​wjones127](https://togithub.com/wjones127) in [https://github.com/lancedb/lance/pull/2436](https://togithub.com/lancedb/lance/pull/2436) - refactor: move Prefilter to a trait and move VectorIndex to lance-vector by [@​eddyxu](https://togithub.com/eddyxu) in [https://github.com/lancedb/lance/pull/2442](https://togithub.com/lancedb/lance/pull/2442) - refactor: move hnsw from lance crate to lance-index crate by [@​eddyxu](https://togithub.com/eddyxu) in [https://github.com/lancedb/lance/pull/2446](https://togithub.com/lancedb/lance/pull/2446) - refactor: impl the sub index trait for HNSW and clean code by [@​BubbleCal](https://togithub.com/BubbleCal) in [https://github.com/lancedb/lance/pull/2462](https://togithub.com/lancedb/lance/pull/2462) #### New Contributors - [@​joshua-auchincloss](https://togithub.com/joshua-auchincloss) made their first contribution in [https://github.com/lancedb/lance/pull/2460](https://togithub.com/lancedb/lance/pull/2460) **Full Changelog**: lancedb/lance@v0.12.1...v0.12.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/spiraldb/vortex). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [lance](https://togithub.com/lancedb/lance) | dependencies | patch | `0.12.1` -> `0.12.2` | --- ### Release Notes <details> <summary>lancedb/lance (lance)</summary> ### [`v0.12.2`](https://togithub.com/lancedb/lance/releases/tag/v0.12.2) [Compare Source](https://togithub.com/lancedb/lance/compare/v0.12.1...v0.12.2) <!-- Release notes generated using configuration in .github/release.yml at v0.12.2 --> #### What's Changed ##### New Features 🎉 - feat: support IVF_FLAT index by [@​BubbleCal](https://togithub.com/BubbleCal) in [https://github.com/lancedb/lance/pull/2418](https://togithub.com/lancedb/lance/pull/2418) - feat: add support for arbitrary global buffers to the v2 reader/writer by [@​westonpace](https://togithub.com/westonpace) in [https://github.com/lancedb/lance/pull/2445](https://togithub.com/lancedb/lance/pull/2445) - feat: add pushdown to the read path by [@​westonpace](https://togithub.com/westonpace) in [https://github.com/lancedb/lance/pull/2444](https://togithub.com/lancedb/lance/pull/2444) - feat: scan with stable row id by [@​wjones127](https://togithub.com/wjones127) in [https://github.com/lancedb/lance/pull/2441](https://togithub.com/lancedb/lance/pull/2441) - feat(java): add lance spark connector for read by [@​LuQQiu](https://togithub.com/LuQQiu) in [https://github.com/lancedb/lance/pull/2429](https://togithub.com/lancedb/lance/pull/2429) - feat: pickle the manifest when pickling a dataset by [@​westonpace](https://togithub.com/westonpace) in [https://github.com/lancedb/lance/pull/2459](https://togithub.com/lancedb/lance/pull/2459) - feat: store IVF in global buffer by [@​BubbleCal](https://togithub.com/BubbleCal) in [https://github.com/lancedb/lance/pull/2449](https://togithub.com/lancedb/lance/pull/2449) ##### Bug Fixes 🐛 - fix: lance.torch.LanceDataset spelt readahead wrong by [@​wjones127](https://togithub.com/wjones127) in [https://github.com/lancedb/lance/pull/2453](https://togithub.com/lancedb/lance/pull/2453) - fix: respect storage options on `create_index` by [@​joshua-auchincloss](https://togithub.com/joshua-auchincloss) in [https://github.com/lancedb/lance/pull/2460](https://togithub.com/lancedb/lance/pull/2460) - fix: incorrect logic when decoding manifest from last block by [@​westonpace](https://togithub.com/westonpace) in [https://github.com/lancedb/lance/pull/2464](https://togithub.com/lancedb/lance/pull/2464) ##### Documentation 📚 - docs: add spark-lance-connector readme by [@​LuQQiu](https://togithub.com/LuQQiu) in [https://github.com/lancedb/lance/pull/2456](https://togithub.com/lancedb/lance/pull/2456) ##### Performance Improvements 🚀 - perf: speed up hnsw build by [@​eddyxu](https://togithub.com/eddyxu) in [https://github.com/lancedb/lance/pull/2448](https://togithub.com/lancedb/lance/pull/2448) - perf: better L2 code generation by [@​eddyxu](https://togithub.com/eddyxu) in [https://github.com/lancedb/lance/pull/2450](https://togithub.com/lancedb/lance/pull/2450) ##### Other Changes - refactor: pull row_id and deletion vector out of v1 file reader by [@​wjones127](https://togithub.com/wjones127) in [https://github.com/lancedb/lance/pull/2436](https://togithub.com/lancedb/lance/pull/2436) - refactor: move Prefilter to a trait and move VectorIndex to lance-vector by [@​eddyxu](https://togithub.com/eddyxu) in [https://github.com/lancedb/lance/pull/2442](https://togithub.com/lancedb/lance/pull/2442) - refactor: move hnsw from lance crate to lance-index crate by [@​eddyxu](https://togithub.com/eddyxu) in [https://github.com/lancedb/lance/pull/2446](https://togithub.com/lancedb/lance/pull/2446) - refactor: impl the sub index trait for HNSW and clean code by [@​BubbleCal](https://togithub.com/BubbleCal) in [https://github.com/lancedb/lance/pull/2462](https://togithub.com/lancedb/lance/pull/2462) #### New Contributors - [@​joshua-auchincloss](https://togithub.com/joshua-auchincloss) made their first contribution in [https://github.com/lancedb/lance/pull/2460](https://togithub.com/lancedb/lance/pull/2460) **Full Changelog**: lancedb/lance@v0.12.1...v0.12.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/spiraldb/vortex). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Currently, if
create_index
is used with non-standard storage backends, or configuration options passed at runtime,lance
does not respect the storage option specified. This can be resolved by checking and passingstorage_options
from thecreate_index
methods to allow for theLanceDataset
to be recreated.