forked from rapidsai/cudf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose stream parameter in public strings split/partition APIs (rapid…
…sai#14247) Follow on to PR rapidsai#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 rapidsai#13744 Authors: - David Wendt (https://github.com/davidwendt) Approvers: - Mark Harris (https://github.com/harrism) - Bradley Dice (https://github.com/bdice) - Nghia Truong (https://github.com/ttnghia) URL: rapidsai#14247
- Loading branch information
1 parent
301dce1
commit aa598bc
Showing
6 changed files
with
89 additions
and
22 deletions.
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()); | ||
} |