-
Notifications
You must be signed in to change notification settings - Fork 915
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
rapids-bot
merged 6 commits into
rapidsai:branch-23.12
from
davidwendt:stream-strings-partition
Oct 11, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4da5749
Expose stream parameter in public strings split/partition APIs
davidwendt d7cfbcb
fix doxygen consistency
davidwendt e24715a
Merge branch 'branch-23.12' into stream-strings-partition
davidwendt 525d31a
Merge branch 'branch-23.12' into stream-strings-partition
davidwendt 95c76e1
Merge branch 'branch-23.12' into stream-strings-partition
davidwendt 5a071e9
fix merge conflict
davidwendt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2023, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <cudf_test/base_fixture.hpp> | ||
#include <cudf_test/column_wrapper.hpp> | ||
#include <cudf_test/default_stream.hpp> | ||
|
||
#include <cudf/strings/regex/regex_program.hpp> | ||
#include <cudf/strings/split/partition.hpp> | ||
#include <cudf/strings/split/split.hpp> | ||
#include <cudf/strings/split/split_re.hpp> | ||
|
||
#include <string> | ||
|
||
class StringsSplitTest : public cudf::test::BaseFixture {}; | ||
|
||
TEST_F(StringsSplitTest, SplitPartition) | ||
{ | ||
auto input = cudf::test::strings_column_wrapper({"Héllo thesé", "tést strings", ""}); | ||
auto view = cudf::strings_column_view(input); | ||
|
||
auto const delimiter = cudf::string_scalar("é", true, cudf::test::get_default_stream()); | ||
cudf::strings::split(view, delimiter, -1, cudf::test::get_default_stream()); | ||
cudf::strings::rsplit(view, delimiter, -1, cudf::test::get_default_stream()); | ||
cudf::strings::split_record(view, delimiter, -1, cudf::test::get_default_stream()); | ||
cudf::strings::rsplit_record(view, delimiter, -1, cudf::test::get_default_stream()); | ||
cudf::strings::partition(view, delimiter, cudf::test::get_default_stream()); | ||
cudf::strings::rpartition(view, delimiter, cudf::test::get_default_stream()); | ||
|
||
auto const pattern = std::string("\\s"); | ||
auto const prog = cudf::strings::regex_program::create(pattern); | ||
cudf::strings::split_re(view, *prog, -1, cudf::test::get_default_stream()); | ||
cudf::strings::split_record_re(view, *prog, -1, cudf::test::get_default_stream()); | ||
cudf::strings::rsplit_re(view, *prog, -1, cudf::test::get_default_stream()); | ||
cudf::strings::rsplit_record_re(view, *prog, -1, cudf::test::get_default_stream()); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ("
ThisCUDA streamisused 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:
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.