Skip to content

Removed deprecated multi-pattern overload of replace_re - #22639

Merged
rapids-bot[bot] merged 10 commits into
NVIDIA:mainfrom
davidwendt:remove-multi-re
May 29, 2026
Merged

Removed deprecated multi-pattern overload of replace_re#22639
rapids-bot[bot] merged 10 commits into
NVIDIA:mainfrom
davidwendt:remove-multi-re

Conversation

@davidwendt

Copy link
Copy Markdown
Contributor

Description

Removes the multi-pattern version of the cudf::strings::replace_re API which was deprecated in 26.06

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 self-assigned this May 22, 2026
@davidwendt davidwendt added 2 - In Progress Currently a work in progress libcudf Affects libcudf (C++/CUDA) code. improvement Improvement / enhancement to an existing function breaking Breaking change labels May 22, 2026
@copy-pr-bot

copy-pr-bot Bot commented May 22, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions Bot added Python Affects Python cuDF API. pylibcudf Issues specific to the pylibcudf package labels May 22, 2026
@GPUtester GPUtester moved this to In Progress in cuDF Python May 22, 2026
@davidwendt

davidwendt commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

Breaking label still breaking the "Trigger Breaking Change Notifications" GHA when PR is in draft.
Will try to remember to change the label when removing from draft.

@davidwendt davidwendt added non-breaking Non-breaking change and removed breaking Breaking change labels May 22, 2026
@davidwendt

Copy link
Copy Markdown
Contributor Author

This change will help remove some complexity from #21936

@davidwendt

Copy link
Copy Markdown
Contributor Author

/ok to test

@github-actions github-actions Bot added the Java Affects Java cuDF API. label May 22, 2026
@davidwendt

Copy link
Copy Markdown
Contributor Author

/ok to test

@github-actions github-actions Bot added the CMake CMake build issue label May 22, 2026
@davidwendt

Copy link
Copy Markdown
Contributor Author

/ok to test

@davidwendt
davidwendt marked this pull request as ready for review May 22, 2026 19:13
@davidwendt
davidwendt requested review from a team as code owners May 22, 2026 19:13
@davidwendt
davidwendt requested a review from vyasr May 22, 2026 19:13
@davidwendt
davidwendt requested review from bdice and galipremsagar May 22, 2026 19:13
@davidwendt davidwendt added 3 - Ready for Review Ready for review by team breaking Breaking change and removed 2 - In Progress Currently a work in progress non-breaking Non-breaking change labels May 22, 2026

@KyleFromNVIDIA KyleFromNVIDIA left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved trivial CMake changes

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 30aff625-86b1-4908-bf63-a5d292fcdc20

📥 Commits

Reviewing files that changed from the base of the PR and between 00327e6 and 5a61a46.

📒 Files selected for processing (1)
  • python/cudf/cudf/core/accessors/string.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • python/cudf/cudf/core/accessors/string.py

📝 Walkthrough

Summary by CodeRabbit

  • Breaking Changes

    • Multi-pattern regex replacement removed across all language bindings; only single-pattern replacement with compiled regex programs is supported.
  • Behavior Change

    • Supplying list-style patterns with regex=True now raises a ValueError (docstrings updated).
  • Tests

    • Removed tests exercising multi-pattern regex replacement.
  • Documentation

    • Docstrings and stub signatures updated to reflect the narrowed API.

Walkthrough

This pull request removes the multi-pattern regex replacement API across C++, Java, and Python, narrowing replace_re to accept a single precompiled regex_program and a scalar replacement; related JNI, bindings, overloads, and tests for multi-pattern behavior are removed or simplified.

Changes

Multi-pattern regex replacement removal

Layer / File(s) Summary
C++ API contract narrowing
cpp/include/cudf/strings/replace_re.hpp, cpp/CMakeLists.txt
Header removes deprecated multi-pattern overload and declares single regex_program-based replace_re signature; CMake switches source from multi_re.cu to multi.cu.
Java binding layer removal
java/src/main/java/ai/rapids/cudf/ColumnView.java, java/src/main/native/src/ColumnViewJni.cpp, java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java
JNI wrapper replaceMultiRegex and Java test case deleted; Java wrapper formatting and native declarations adjusted to reflect narrowed C++ API.
cudf high-level Python API
python/cudf/cudf/core/accessors/string.py, python/cudf/cudf/core/column/string.py
StringColumn.replace_re signature narrowed to (pattern: str, replacement: str); StringMethods.replace now raises ValueError for list-like pat/repl when regex=True.
Python pylibcudf Cython binding
python/pylibcudf/pylibcudf/libcudf/strings/replace_re.pxd, python/pylibcudf/pylibcudf/strings/replace_re.pxd, python/pylibcudf/pylibcudf/strings/replace_re.pyx
Extern declaration and pyx wrapper updated to accept regex_program + string_scalar/Scalar; fused-type overloads, vector import, and regex_flags pathway removed; implementation simplified to single call into C++.
Python pylibcudf type stubs
python/pylibcudf/pylibcudf/strings/replace_re.pyi
Overload-based stub removed; single declaration exposing RegexProgram and Scalar parameters remains.
Test and documentation updates
python/pylibcudf/tests/test_string_replace_re.py
SPDX year extended to 2026; parametrized test covering list-of-patterns/list-of-replacements removed.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the primary change: removal of the deprecated multi-pattern overload of the replace_re function across multiple layers (C++, Python, Java).
Description check ✅ Passed The description is directly related to the changeset, clearly stating the removal of the multi-pattern version of the replace_re API that was deprecated in version 26.06.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@python/cudf/cudf/core/accessors/string.py`:
- Around line 1035-1038: The string accessor replace implementation now raises
ValueError when list-like pat/repl are used together with regex=True; update the
docstring for the replace method in cudf/core/accessors/string.py
(Series.str.replace) to explicitly document that list-like pat/repl are not
supported when regex=True and that regex defaults to True, and add a cudf-level
regression test (e.g., in tests/string/test_replace.py) that calls
Series.str.replace([...], [...], regex=True) and asserts it raises ValueError to
prevent regressions.

In `@python/pylibcudf/pylibcudf/strings/replace_re.pyx`:
- Around line 61-70: The code currently casts replacement to a string_scalar*
without validating its type, which can cause UB; before entering the with nogil:
block in replace_re, check that replacement is either None or a string Scalar
(e.g., ensure replacement.type corresponds to string/string_scalar) and raise a
Python-level TypeError if not, then only pass
dereference(<string_scalar*>(replacement.get())) to cpp_replace_re.replace_re
when the check has succeeded (or alternatively change the Cython signature to
accept a string_scalar specifically); ensure the validation happens on the
Python side before the with nogil: to avoid performing type checks without the
GIL.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b98da430-97e4-4a65-a72e-a6d9f9e20205

📥 Commits

Reviewing files that changed from the base of the PR and between 3cfe15b and 1c84806.

📒 Files selected for processing (13)
  • cpp/CMakeLists.txt
  • cpp/include/cudf/strings/replace_re.hpp
  • cpp/src/strings/replace/multi_re.cu
  • java/src/main/java/ai/rapids/cudf/ColumnView.java
  • java/src/main/native/src/ColumnViewJni.cpp
  • java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java
  • python/cudf/cudf/core/accessors/string.py
  • python/cudf/cudf/core/column/string.py
  • python/pylibcudf/pylibcudf/libcudf/strings/replace_re.pxd
  • python/pylibcudf/pylibcudf/strings/replace_re.pxd
  • python/pylibcudf/pylibcudf/strings/replace_re.pyi
  • python/pylibcudf/pylibcudf/strings/replace_re.pyx
  • python/pylibcudf/tests/test_string_replace_re.py
💤 Files with no reviewable changes (8)
  • cpp/CMakeLists.txt
  • cpp/include/cudf/strings/replace_re.hpp
  • python/pylibcudf/pylibcudf/libcudf/strings/replace_re.pxd
  • python/pylibcudf/pylibcudf/strings/replace_re.pyi
  • cpp/src/strings/replace/multi_re.cu
  • java/src/main/native/src/ColumnViewJni.cpp
  • java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java
  • java/src/main/java/ai/rapids/cudf/ColumnView.java

Comment thread python/cudf/cudf/core/accessors/string.py
Comment thread python/pylibcudf/pylibcudf/strings/replace_re.pyx
@GregoryKimball

Copy link
Copy Markdown
Contributor

@mythrocks (@sameerz ) We are planning to remove the JNI binding and would like your feedback.

Comment thread python/cudf/cudf/core/accessors/string.py
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Actionable comments posted: 0

@davidwendt

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit 049531c into NVIDIA:main May 29, 2026
321 of 325 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python May 29, 2026
@davidwendt
davidwendt deleted the remove-multi-re branch May 29, 2026 18: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 breaking Breaking change CMake CMake build issue improvement Improvement / enhancement to an existing function Java Affects Java cuDF API. libcudf Affects libcudf (C++/CUDA) code. pylibcudf Issues specific to the pylibcudf package Python Affects Python cuDF API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants