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 pattern parameter for regex APIs from std::string to std::string_view #10810

Merged
merged 8 commits into from
May 13, 2022

Conversation

davidwendt
Copy link
Contributor

The input string pattern does not require a heavy-weight std::string object but can accept a std::string_view now that we compile with c++17 for libcudf and cython. Literal strings (null-terminated char array), std::string and std::string_view objects can not be passed for the pattern parameter on these APIs.
https://docs.rapids.ai/api/libcudf/stable/group__strings__contains.html

Although Cython does not have a native libcpp.string_view representation, the Cython code works because the libcpp.string is automatically convertable to a std::string_view. However, the multi-pattern version replace_re could not be changed because Cython is unable to build a std::vector<std::string_view> instance at this time.

Likewise, the Java code's std::string pattern parameters are automatically converted to std::string_view instances.

@davidwendt davidwendt added 2 - In Progress Currently a work in progress libcudf Affects libcudf (C++/CUDA) code. strings strings issues (C++ and Python) improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels May 6, 2022
@davidwendt davidwendt self-assigned this May 6, 2022
@codecov
Copy link

codecov bot commented May 6, 2022

Codecov Report

Merging #10810 (81bc8d3) into branch-22.06 (e0d94f3) will increase coverage by 0.02%.
The diff coverage is n/a.

@@               Coverage Diff                @@
##           branch-22.06   #10810      +/-   ##
================================================
+ Coverage         86.28%   86.31%   +0.02%     
================================================
  Files               144      144              
  Lines             22654    22654              
================================================
+ Hits              19548    19554       +6     
+ Misses             3106     3100       -6     
Impacted Files Coverage Δ
python/cudf/cudf/core/dataframe.py 93.78% <0.00%> (+0.04%) ⬆️
python/cudf/cudf/core/column/string.py 88.78% <0.00%> (+0.12%) ⬆️
python/cudf/cudf/core/groupby/groupby.py 91.79% <0.00%> (+0.22%) ⬆️
python/cudf/cudf/core/tools/datetimes.py 84.49% <0.00%> (+0.30%) ⬆️
python/cudf/cudf/core/column/lists.py 91.70% <0.00%> (+0.97%) ⬆️

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 fe9aaeb...81bc8d3. Read the comment docs.

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.

🚀 Small, self-contained PRs 🚀

@davidwendt davidwendt added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currently a work in progress labels May 11, 2022
@davidwendt davidwendt marked this pull request as ready for review May 11, 2022 13:29
@davidwendt davidwendt requested a review from a team as a code owner May 11, 2022 13:29
@davidwendt davidwendt requested review from trxcllnt and vuule May 11, 2022 13:29
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

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

One suggestion - otherwise echoing @jrhemstad: 🚀 Small self-contained PRs! 🚀

cpp/src/strings/replace/backref_re.cu Outdated Show resolved Hide resolved
@davidwendt
Copy link
Contributor Author

@gpucibot merge

@rapids-bot rapids-bot bot merged commit b64452a into rapidsai:branch-22.06 May 13, 2022
@davidwendt davidwendt deleted the regex-string-view-parm branch May 13, 2022 00:04
rapids-bot bot pushed a commit that referenced this pull request May 19, 2022
…ew (#10832)

Follow on to #10810. This changes other occurrences of parameter type `std::string` to `std::string_view` in the non-regex APIs. 
This covers `cudf::strings::pad` fill-char and the to/from-timestamp/duration converters that accept format specifiers.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Mike Wilson (https://github.com/hyperbolic2346)
  - Bradley Dice (https://github.com/bdice)

URL: #10832
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 improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change strings strings issues (C++ and Python)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants