Conversation
…#781) - Guard against kInvalidKey (UINT64_MAX) during HNSW, Sparse HNSW, and RaBitQ HNSW group neighbor expansion. - Prevent ID out of range errors in DocFilter and VectorRecallNode when querying invalid/unmapped doc keys. - Add regression test Feature_GroupByQuery_HnswWithFilter in collection_test.
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.
Problem
Fixes #781.
When executing
Collection.group_by_querywith a scalar filter predicate on an HNSW index, the query returned empty results with error logs:Root Cause:
expand_neighbors_by_group), search heap nodes may returnkInvalidKey(UINT64_MAX) when unmapped or deleted.UINT64_MAXtoDocFilter::is_filtered()caused an out-of-bounds access in the bitmap and returnednullopt(unfiltered).VectorRecallNode::group_fun, which invokedsegment_->fetchwithrow_id = UINT64_MAX(-1), failing to fetch the group field and aborting group formation.Solution
hnsw_algorithm.cc,hnsw_sparse_algorithm.cc,hnsw_rabitq_query_algorithm.cc):kInvalidKeyduring initial group partitioning.kInvalidKey.filterlambda to treatkInvalidKeyas filtered (true), preventing unmapped nodes from being selected or expanded.DocFilter(doc_filter.cc):if (id == std::numeric_limits<uint64_t>::max() || id >= segment_->doc_count()) return true;to prevent bitmap index overruns.VectorRecallNode(vector_recall_node.cc):group_funagainst invalidrow_id/UINT64_MAXbefore callingsegment_->fetch().collection_test.cc):Feature_GroupByQuery_HnswWithFilterverifying filteredgroup_by_queryon HNSW index for both in-memory and mmap collections.