Skip to content
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

hgraph index When the query result is 0, a bad_alloc error is reported #369

Open
Carrot-77 opened this issue Jan 27, 2025 · 0 comments
Open
Assignees

Comments

@Carrot-77
Copy link
Contributor

Describe the bug
hgraph index When the query result is 0, a bad_alloc error is reported
Since the query result data is 0, the result memory of size 0 is applied, resulting in the application failure and error bad_alloc

To Reproduce
Codes to reproduce the behavior:

nlohmann::json hnswsq_parameters{{"base_quantization_type", "sq8"}, 
                                            {"max_degree", max_degree}, 
                                            {"ef_construction", ef_construction},
                                            {"build_thread_count", 1}};
nlohmann::json index_parameters{{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"index_param", hnswsq_parameters}}; 
auto index = vsag::Factory::CreateIndex("hgraph", index_parameters.dump(), vsag_allocator);
HnswIndexHandler* hnsw = static_cast<HnswIndexHandler*>(index_handler); 
auto dataset = vsag::Dataset::Make();
dataset->Dim(dim)
    ->NumElements(11000)
    ->Ids(ids)
    ->Float32Vectors(vector_list)
    ->Owner(false);
ret = hnsw->build_index(dataset);
query->NumElements(1)->Dim(dim)->Float32Vectors(query_vector)->Owner(false);
// The data filtered by the filter is 100%
ret = hnsw->knn_search(query, topk, search_parameters.dump(), dist, ids, result_size, filter);

Environment
Please run bash scripts/check_environment.sh and paste the output here:

  • OS: e.g. Ubuntu 22.04
  • vsag version: e.g. v0.11.0 or 7f94a27
  • compiler version: e.g. GCC 11.4.0
  • interface: cpp or python

Expected behavior
Verify the returned result like hnsw

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants