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

Fix regex parsing logic handling of nested quantifiers #16798

Merged
merged 9 commits into from
Oct 10, 2024

Conversation

davidwendt
Copy link
Contributor

Description

Fixes the libcudf regex parsing logic when handling nested fixed quantifiers. The logic handles fixed quantifiers by simple repeating the previous instruction. If the previous item is a group (capture or non-capture) that group may also contain an internal fixed quantifier as well.
Found while working on #16730

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 bug Something isn't working 2 - In Progress Currently a work in progress libcudf Affects libcudf (C++/CUDA) code. strings strings issues (C++ and Python) non-breaking Non-breaking change labels Sep 11, 2024
@davidwendt davidwendt self-assigned this Sep 11, 2024
@davidwendt davidwendt changed the base branch from branch-24.10 to branch-24.12 September 23, 2024 23:31
@davidwendt davidwendt added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currently a work in progress labels Sep 27, 2024
@davidwendt davidwendt marked this pull request as ready for review September 30, 2024 15:14
@davidwendt davidwendt requested a review from a team as a code owner September 30, 2024 15:14
Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

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

If I understand correctly, all of the in->out substitutions exist because in the nested case out could be filled with additional instructions (lines 746-759), so the sizes now depend on that. Is that right? I think I've grokked this PR but I want to confirm my understanding before I approve.

Out of scope for this PR, but should regcomp.h be renamed to regcomp.hpp? It's not a C header, there are classes in there.

cpp/src/strings/regex/regcomp.cpp Show resolved Hide resolved
@davidwendt
Copy link
Contributor Author

That sounds right. Previously it was just copying the input and so did not account for previous expanded (nested) instructions.
I can look into renaming the header. The original implementation came from C source I believe.

@davidwendt
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 7173b52 into rapidsai:branch-24.12 Oct 10, 2024
100 checks passed
@davidwendt davidwendt deleted the regex-nested-quantifier branch October 10, 2024 12:48
rapids-bot bot pushed a commit that referenced this pull request Oct 15, 2024
Fixes regex logic handling of a pattern with a fixed quantifier that includes a zero-range.
Added new gtests for this specific case.
Bug was introduced in #16798 

Closes #17065

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Robert (Bobby) Evans (https://github.com/revans2)
  - Vyas Ramasubramani (https://github.com/vyasr)
  - MithunR (https://github.com/mythrocks)
  - Basit Ayantunde (https://github.com/lamarrr)

URL: #17067
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 bug Something isn't working 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.

3 participants