feat: support hamming clustering#6265
Open
jackye1995 wants to merge 7 commits intolance-format:mainfrom
Open
Conversation
Contributor
PR Review: feat: support hamming clusteringP1:
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- Change return type from dict/struct to Box<dyn RecordBatchReader + Send> - Output schema: representative (uint64), duplicates (list<uint64>) - ClusteringResult::into_reader() yields batches of 10k clusters - Rename hamming_cluster_hashes -> hamming_clustering_from_hashes - Log timing info via tracing instead of returning in struct - Python bindings return pa.RecordBatchReader Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Use take_rows() which returns _rowid column, instead of using positional indices from sample() as row IDs. This ensures the cluster results contain actual row IDs that can be used for downstream operations like deleting duplicates. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
- Fix sampling path to request _rowid column explicitly in take_rows projection - Add integration tests for IVF partition clustering and sampled clustering - Remove .unwrap() in Python binding closures, use ? operator - Change to_record_batch to into_record_batch to avoid cloning Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
take() accepts positional indices (0 to num_rows-1), while take_rows() expects internal ROW IDs. The sample() function returns positional indices. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
- Rename hamming_clustering_sampled to hamming_clustering_for_sample for consistency with hamming_clustering_for_ivf_partition naming convention - Add hamming_clustering_for_range function that reads a contiguous range of rows from a specific fragment and performs hamming clustering - This is useful for distributed processing where each worker handles a specific range of a fragment - Add Python bindings and type stubs for both functions - Add Rust tests for the new hamming_clustering_for_range function Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
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.
Add support for SIMD accelerated pairwise hamming distance computation, and the ability to compute a cluster of binary vectors that are within a given hamming distance threshold, these are considered similar or potentially duplicated vectors of the original representation.
Also expose the feature in python for easy consumption.