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

Expose stream parameter in public strings split/partition APIs #14247

Merged
merged 6 commits into from
Oct 11, 2023

Conversation

davidwendt
Copy link
Contributor

Description

Follow on to PR #13997 which did not include all the split APIs or a stream test.
Add stream parameter to public APIs:

  • cudf::strings::partition()
  • cudf::strings::rpartition()
  • cudf::strings::split_re()
  • cudf::strings::rsplit_re()
  • cudf::strings::split_record_re()
  • cudf::strings::rsplit_record_re()

Also cleaned up some of the doxygen comments.

Reference #13744

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@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 Oct 4, 2023
@davidwendt davidwendt self-assigned this Oct 4, 2023
@github-actions github-actions bot added the CMake CMake build issue label Oct 4, 2023
@davidwendt davidwendt added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currently a work in progress labels Oct 4, 2023
@davidwendt davidwendt marked this pull request as ready for review October 6, 2023 12:08
@davidwendt davidwendt requested a review from a team as a code owner October 6, 2023 12:08
@davidwendt davidwendt requested review from harrism and ttnghia October 6, 2023 12:08
Comment on lines +54 to +59
* @param input Strings instance for this operation
* @param delimiter UTF-8 encoded string indicating where to split each string.
* Default of empty string indicates split on whitespace.
* @param mr Device memory resource used to allocate the returned table's device memory.
* @return New table of strings columns.
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate the returned table's device memory
* @return New table of strings columns
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: It is a bit awkward to have mixed style like this: some sentences end with period while some others don't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you suggest for the delimiter parameter description? I've used semi-colon before but that was criticized as well.

Copy link
Contributor

@ttnghia ttnghia Oct 6, 2023

Choose a reason for hiding this comment

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

This is a difficult question too. IMO the best and most consistent way is to end every sentence with a period so we don't have situations like this. But since we are not using period, probably we should avoid having separate sentences for each parameter description. For example:

 * @param delimiter UTF-8 encoded string indicating where to split each string,
 *        default of empty string indicates split on whitespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is these descriptions are not sentences and so do not warrant a period.
I'll go with a comma for now if that looks better though I'd prefer a semi-colon.
Unfortunately, we don't seem to have any consensus on this.

Copy link
Member

@harrism harrism Oct 8, 2023

Choose a reason for hiding this comment

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

I'll weigh in. :) Docs are writing that we would like to be readable, so we should apply sound style and grammar rules. If it's a sentence, end it with a period. I argue that parameter definitions should be sentences, even though we often leave out definite articles and pronouns and the verb ("to be") is often implied ("This CUDA stream is used for device memory operations and kernel launches."). Treating them all as sentences ensures consistent style when a parameter definition requires more than one sentence, as in this case.

I agree that semicolons are fine to use where appropriate. Dusting off my copy of Strunk & White, chapter 1:

(Rule 5) Do not join independent clauses with a comma. If two or more clauses grammatically complete and not joined by a conjunction are to form a single compound sentence, the proper mark of punctuation is a semicolon.
(Rule 6) Do not break sentences in two. In other words, don't use periods as commas.

Mr. White didn't give a rule for when to decide that two clauses should form a compound sentence, though he mentioned typical usage is "cause and consequence". Personally I think in the case of delimiter it makes sense as two sentences the way you have it.

Copy link
Member

@harrism harrism left a comment

Choose a reason for hiding this comment

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

Looks good, style debates aside. :)

Comment on lines +54 to +59
* @param input Strings instance for this operation
* @param delimiter UTF-8 encoded string indicating where to split each string.
* Default of empty string indicates split on whitespace.
* @param mr Device memory resource used to allocate the returned table's device memory.
* @return New table of strings columns.
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate the returned table's device memory
* @return New table of strings columns
Copy link
Member

@harrism harrism Oct 8, 2023

Choose a reason for hiding this comment

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

I'll weigh in. :) Docs are writing that we would like to be readable, so we should apply sound style and grammar rules. If it's a sentence, end it with a period. I argue that parameter definitions should be sentences, even though we often leave out definite articles and pronouns and the verb ("to be") is often implied ("This CUDA stream is used for device memory operations and kernel launches."). Treating them all as sentences ensures consistent style when a parameter definition requires more than one sentence, as in this case.

I agree that semicolons are fine to use where appropriate. Dusting off my copy of Strunk & White, chapter 1:

(Rule 5) Do not join independent clauses with a comma. If two or more clauses grammatically complete and not joined by a conjunction are to form a single compound sentence, the proper mark of punctuation is a semicolon.
(Rule 6) Do not break sentences in two. In other words, don't use periods as commas.

Mr. White didn't give a rule for when to decide that two clauses should form a compound sentence, though he mentioned typical usage is "cause and consequence". Personally I think in the case of delimiter it makes sense as two sentences the way you have it.

@davidwendt
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit aa598bc into rapidsai:branch-23.12 Oct 11, 2023
58 checks passed
@davidwendt davidwendt deleted the stream-strings-partition branch October 11, 2023 19:36
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 CMake CMake build issue 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.

4 participants