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

Add following APIs to facilitate DataSet conversion #659

Merged

Conversation

cydrain
Copy link
Collaborator

@cydrain cydrain commented Jun 20, 2024

  • ConvertFromDataTypeIfNeeded()
  • ConvertToDataTypeIfNeeded()

 * ConvertFromDataTypeIfNeeded()
 * ConvertToDataTypeIfNeeded()

Signed-off-by: Cai Yudong <[email protected]>
@cydrain
Copy link
Collaborator Author

cydrain commented Jun 20, 2024

/kind improvement

Copy link

codecov bot commented Jun 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.49%. Comparing base (3c46f4c) to head (31b9845).
Report is 97 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           main     #659       +/-   ##
=========================================
+ Coverage      0   71.49%   +71.49%     
=========================================
  Files         0       69       +69     
  Lines         0     4719     +4719     
=========================================
+ Hits          0     3374     +3374     
- Misses        0     1345     +1345     

see 69 files with indirect coverage changes

@mergify mergify bot added the ci-passed label Jun 20, 2024
@cydrain
Copy link
Collaborator Author

cydrain commented Jun 20, 2024

/hold

@sre-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cydrain, Presburger

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

inline std::shared_ptr<const DataSet>
ConvertFromDataTypeIfNeeded(const DataSet& ds) {
if constexpr (std::is_same_v<DataType, typename MockData<DataType>::type>) {
return ds.shared_from_this();
Copy link
Collaborator

@zhengbuqian zhengbuqian Jun 25, 2024

Choose a reason for hiding this comment

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

this is very strange: we don't know who owns the dataset, how can we just create a shared ptr from it? This implicitly requires the passed in ds to be already managed by a shared ptr(not a stack obj, not a raw or unique ptr). This requirement is satisfied for now, but could lead to a hard to find bug in the future.

but this issue is not introduced by this PR, we can figure out a solution and put up a fix later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

plan to file another PR to change all APIs' input parameter to shared_ptr to avoid this issue completely

@zhengbuqian
Copy link
Collaborator

/lgtm

@cydrain
Copy link
Collaborator Author

cydrain commented Jun 25, 2024

/unhold

@sre-ci-robot sre-ci-robot merged commit d69e0f3 into zilliztech:main Jun 25, 2024
13 checks passed
@cydrain cydrain deleted the caiyd_add_multi_data_type_convert_api branch June 25, 2024 03:42
xxxlzhxxx pushed a commit to xxxlzhxxx/knowhere that referenced this pull request Jul 23, 2024
* ConvertFromDataTypeIfNeeded()
 * ConvertToDataTypeIfNeeded()

Signed-off-by: Cai Yudong <[email protected]>
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.

4 participants