refactor(sqlite-provider): switch from pack_key to monotonic integer keys#5
Merged
Merged
Conversation
| /// connections (WAL allows N concurrent readers). | ||
| /// | ||
| /// `local_parquet_files`, `layout`, `schema`, and `parquet_col_indices` | ||
| /// `local_parquet_files`, `schema`, and `parquet_col_indices` |
There was a problem hiding this comment.
Suggestion: callers pairing this provider with a USearch index now need to use monotonic keys (0, 1, 2, …) when calling index.add() — the previous implicit contract was pack_key(file_idx, rg_idx, lo). Worth a one-liner here so the contract is visible at the call site:
Suggested change
| /// `local_parquet_files`, `schema`, and `parquet_col_indices` | |
| /// are only used if the table does not yet exist. Row keys are assigned | |
| /// as monotonic integers (0, 1, 2, …) in file-iteration order; any | |
| /// USearch index used alongside this provider must use the same scheme. |
…keys SqliteLookupProvider treats keys as opaque INTEGER PRIMARY KEY and USearch treats them as opaque u64 labels — the bit-packed encoding via pack_key was unnecessary complexity. Replace with a simple monotonic counter (0, 1, 2, ...) which removes the DatasetLayout dependency from open_or_build/build_table and lifts the artificial 16-bit capacity limits on file_idx/rg_idx.
9de723a to
a599ac6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pack_key(file_idx, rg_idx, local_offset)with monotonic integer keys (0, 1, 2, ...) inSqliteLookupProviderlayout: &DatasetLayoutparameter fromopen_or_build()andbuild_table()DatasetLayout,pack_key, andunpack_keyremain exported —ParquetLookupProviderstill uses themBoth
SqliteLookupProviderand USearch treat keys as opaque integers, so the bit-packed encoding was unnecessary complexity with artificial 16-bit capacity limits onfile_idx/rg_idx.Test plan
ParquetLookupProvidertests unaffected (still usepack_key)