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

Change nvtext::load_vocabulary_file to return a unique ptr #7424

Merged
merged 2 commits into from
Feb 24, 2021

Conversation

davidwendt
Copy link
Contributor

@davidwendt davidwendt commented Feb 22, 2021

Reference #5868

This PR changes the nvtext::load_vocabulary_file to return a unique-pointer to make it easier to manage in Python/Cython class object. The original signature returned a flat structure that contained unique-pointers which would make it difficult to copy and manage.

The corresponding gtests and gbenchmarks were updated for this API change.

@davidwendt davidwendt added 3 - Ready for Review Ready for review by team libcudf Affects libcudf (C++/CUDA) code. strings strings issues (C++ and Python) improvement Improvement / enhancement to an existing function breaking Breaking change labels Feb 22, 2021
@davidwendt davidwendt self-assigned this Feb 22, 2021
@davidwendt davidwendt requested a review from a team as a code owner February 22, 2021 22:15
Copy link
Contributor

@jrhemstad jrhemstad left a comment

Choose a reason for hiding this comment

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

This is a code smell. There is rarely a reason to return a shared_ptr from a function. It should likely return a unique_ptr and if someone desires a shared_ptr they can trivially make it into one.

@kkraus14
Copy link
Collaborator

This is a code smell. There is rarely a reason to return a shared_ptr from a function. It should likely return a unique_ptr and if someone desires a shared_ptr they can trivially make it into one.

Just commenting that from the Python side we can handle a unique_ptr or a shared_ptr so defer to libcudf semantics here.

@davidwendt davidwendt changed the title Change nvtext::load_vocabulary_file to return shared ptr Change nvtext::load_vocabulary_file to return a unique ptr Feb 22, 2021
@codecov
Copy link

codecov bot commented Feb 23, 2021

Codecov Report

❗ No coverage uploaded for pull request base (branch-0.19@b887e58). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff               @@
##             branch-0.19    #7424   +/-   ##
==============================================
  Coverage               ?   82.21%           
==============================================
  Files                  ?      101           
  Lines                  ?    17057           
  Branches               ?        0           
==============================================
  Hits                   ?    14023           
  Misses                 ?     3034           
  Partials               ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b887e58...6efbf6e. Read the comment docs.

Copy link
Contributor

@codereport codereport left a comment

Choose a reason for hiding this comment

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

lgtm

@davidwendt
Copy link
Contributor Author

@gpucibot merge

@rapids-bot rapids-bot bot merged commit b0e5aef into rapidsai:branch-0.19 Feb 24, 2021
@davidwendt davidwendt deleted the hashed-vocab-ptr branch February 24, 2021 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team breaking Breaking change improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. strings strings issues (C++ and Python)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants