Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,6 @@ add_library(
src/strings/replace/backref_re.cu
src/strings/replace/find_replace.cu
src/strings/replace/multi.cu
src/strings/replace/multi_re.cu
src/strings/replace/replace.cu
src/strings/replace/replace_nulls.cu
src/strings/replace/replace_re.cu
Expand Down
26 changes: 0 additions & 26 deletions cpp/include/cudf/strings/replace_re.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,6 @@ std::unique_ptr<column> replace_re(
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief For each string, replaces any character sequence matching the given patterns
* with the corresponding string in the `replacements` column.
*
* @deprecated in 26.06. To be removed in a future release.
*
* Any null string entries return corresponding null output column entries.
*
* See the @ref md_regex "Regex Features" page for details on patterns supported by this API.
*
* @param input Strings instance for this operation
* @param patterns The regular expression patterns to search within each string
* @param replacements The strings used for replacement
* @param flags Regex flags for interpreting special characters in the patterns
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate the returned column's device memory
* @return New strings column
*/
[[deprecated]] std::unique_ptr<column> replace_re(
strings_column_view const& input,
std::vector<std::string> const& patterns,
strings_column_view const& replacements,
regex_flags const flags = regex_flags::DEFAULT,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief For each string, replaces any character sequence matching the given regex
* using the replacement template for back-references.
Expand Down
213 changes: 0 additions & 213 deletions cpp/src/strings/replace/multi_re.cu

This file was deleted.

23 changes: 0 additions & 23 deletions java/src/main/java/ai/rapids/cudf/ColumnView.java
Original file line number Diff line number Diff line change
Expand Up @@ -3505,19 +3505,6 @@ public final ColumnVector replaceRegex(RegexProgram regexProg, Scalar repl, int
regexProg.capture().nativeId, repl.getScalarHandle(), maxRepl));
}

/**
* For each string, replaces any character sequence matching any of the regular expression
* patterns with the corresponding replacement strings.
*
* @param patterns The regular expression patterns to search within each string.
* @param repls The string scalars to replace for each corresponding pattern match.
* @return A new column vector containing the string results.
*/
public final ColumnVector replaceMultiRegex(String[] patterns, ColumnView repls) {
return new ColumnVector(replaceMultiRegex(getNativeView(), patterns,
repls.getNativeView()));
}

/**
* For each string, replaces any character sequence matching the given pattern
* using the replace template for back-references.
Expand Down Expand Up @@ -4806,16 +4793,6 @@ private static native long substringColumn(long columnView, long startColumn, lo
private static native long replaceRegex(long columnView, String pattern, int flags, int capture,
long repl, long maxRepl) throws CudfException;

/**
* Native method for multiple instance regular expression replacement.
* @param columnView native handle of the cudf::column_view being operated on.
* @param patterns native handle of the cudf::column_view containing the regex patterns.
* @param repls The replacement template for creating the output string.
* @return native handle of the resulting cudf column containing the string results.
*/
private static native long replaceMultiRegex(long columnView, String[] patterns,
long repls) throws CudfException;

/**
* Native method for replacing any character sequence matching the given regex program
* pattern using the replace template for back-references.
Expand Down
19 changes: 0 additions & 19 deletions java/src/main/native/src/ColumnViewJni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2013,25 +2013,6 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_replaceRegex(JNIEnv* env,
JNI_CATCH(env, 0);
}

JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_replaceMultiRegex(
JNIEnv* env, jclass, jlong j_column_view, jobjectArray j_patterns, jlong j_repls)
{
JNI_NULL_CHECK(env, j_column_view, "column is null", 0);
JNI_NULL_CHECK(env, j_patterns, "patterns is null", 0);
JNI_NULL_CHECK(env, j_repls, "repls is null", 0);
JNI_TRY
{
cudf::jni::auto_set_device(env);
auto cv = reinterpret_cast<cudf::column_view const*>(j_column_view);
cudf::strings_column_view scv(*cv);
cudf::jni::native_jstringArray patterns(env, j_patterns);
auto repl_cv = reinterpret_cast<cudf::column_view const*>(j_repls);
cudf::strings_column_view repl_scv(*repl_cv);
return release_as_jlong(cudf::strings::replace_re(scv, patterns.as_cpp_vector(), repl_scv));
}
JNI_CATCH(env, 0);
}

JNIEXPORT jlong JNICALL
Java_ai_rapids_cudf_ColumnView_stringReplaceWithBackrefs(JNIEnv* env,
jclass,
Expand Down
12 changes: 0 additions & 12 deletions java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5268,18 +5268,6 @@ void testReplaceRegex() {
}
}

@Test
void testReplaceMultiRegex() {
try (ColumnVector v =
ColumnVector.fromStrings("title and Title with title", "nothing", null, "Title");
ColumnVector repls = ColumnVector.fromStrings("Repl", "**");
ColumnVector actual = v.replaceMultiRegex(new String[] { "[tT]itle", "and|th" }, repls);
ColumnVector expected =
ColumnVector.fromStrings("Repl ** Repl wi** Repl", "no**ing", null, "Repl")) {
assertColumnsAreEqual(expected, actual);
}
}

@Test
void testStringReplaceWithBackrefs() {

Expand Down
11 changes: 3 additions & 8 deletions python/cudf/cudf/core/accessors/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@ def replace(
Number of replacements to make from the start.
regex : bool, default True
If True, assumes the pattern is a regular expression.
Raises ValueError if pat is not a string.
Comment thread
davidwendt marked this conversation as resolved.
If False, treats the pattern as a literal string.

Returns
Expand Down Expand Up @@ -1033,14 +1034,8 @@ def replace(
)

if regex:
warnings.warn(
"regex support for multiple replace patterns "
"will be removed in a future version.",
FutureWarning,
)
result = self._column.replace_re(
list(pat),
as_column(repl, dtype=DEFAULT_STRING_DTYPE), # type: ignore[arg-type]
raise ValueError(
"multiple pattern replace with regex=True is not supported"
)
Comment thread
davidwendt marked this conversation as resolved.
else:
result = self._column.replace_multiple(
Expand Down
Loading
Loading