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

Support numpy array to sparse dataset in pyknowhere api #654

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

chasingegg
Copy link
Collaborator

/kind improvement

@sre-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chasingegg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

codecov bot commented Jun 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.40%. Comparing base (3c46f4c) to head (bc3f270).
Report is 95 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           main     #654       +/-   ##
=========================================
+ Coverage      0   71.40%   +71.40%     
=========================================
  Files         0       69       +69     
  Lines         0     4728     +4728     
=========================================
+ Hits          0     3376     +3376     
- Misses        0     1352     +1352     

see 69 files with indirect coverage changes

@chasingegg chasingegg changed the title Support numpy array to knowhere dataset in pyknowhere api Support numpy array to sparse dataset in pyknowhere api Jun 18, 2024
@@ -355,6 +359,39 @@ CurrentVersion() {
return knowhere::Version::GetCurrentVersion().VersionNumber();
}

knowhere::DataSetPtr
Array2SparseDataSet(float* data, int nb1, int* ids, int nb2, int64_t* indptr, int nrow) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename nrow since it doesn't mean nrow

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to nb3

int64_t start = indptr[i];
int64_t end = indptr[i+1];
if (start == end) {
continue;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually we don't allow empty row. let's throw an error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@zhengbuqian
Copy link
Collaborator

look good to me overall, with nits

Signed-off-by: chasingegg <chao.gao@zilliz.com>
@zhengbuqian
Copy link
Collaborator

/lgtm

@mergify mergify bot added the ci-passed label Jun 20, 2024
@sre-ci-robot sre-ci-robot merged commit 3a8be5a into zilliztech:main Jun 20, 2024
13 checks passed
@chasingegg chasingegg deleted the sparse-numpy branch June 20, 2024 13:15
xxxlzhxxx pushed a commit to xxxlzhxxx/knowhere that referenced this pull request Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants