-
Notifications
You must be signed in to change notification settings - Fork 240
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
Transpile simple choice-type regular expressions into lists of choices to use with string replace multi #7967
Merged
NVnavkumar
merged 10 commits into
NVIDIA:branch-23.04
from
NVnavkumar:re-transpile-replace-multi
Apr 3, 2023
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c24e3c6
WIP: String replace multi transpile for regexp
NVnavkumar 348ebea
Incorporate string replace multi for simple versions of regex choices
NVnavkumar 61a6c2a
Merge branch 'branch-23.04' of github.com:NVIDIA/spark-rapids into re…
NVnavkumar 4e1445e
Merge branch 'branch-23.04' of github.com:NVIDIA/spark-rapids into re…
NVnavkumar 7d7db6f
Fix logic issue: regexp implmentation should always be used when ther…
NVnavkumar 5271605
Fix scalastyle issue
NVnavkumar 0e9ee4c
Add support for choices inside capture groups
NVnavkumar 31fa6ed
Add unit test for getChoicesFromRegex
NVnavkumar 8d64e17
Merge branch 'branch-23.04' of github.com:NVIDIA/spark-rapids into re…
NVnavkumar c0ab137
fix scalastyle
NVnavkumar 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -593,6 +593,11 @@ object GpuOverrides extends Logging { | |||||
lit.value == null | ||||||
} | ||||||
|
||||||
def isSupportedStringReplacePattern(strLit: String): Boolean = { | ||||||
// check for regex special characters, except for \u0000 which we can support | ||||||
!regexList.filterNot(_ == "\u0000").exists(pattern => strLit.contains(pattern)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's more readable in a conjunctive form, but it is not part of your PR, so very optional:
Suggested change
|
||||||
} | ||||||
|
||||||
def isSupportedStringReplacePattern(exp: Expression): Boolean = { | ||||||
extractLit(exp) match { | ||||||
case Some(Literal(null, _)) => false | ||||||
|
@@ -602,7 +607,7 @@ object GpuOverrides extends Logging { | |||||
false | ||||||
} else { | ||||||
// check for regex special characters, except for \u0000 which we can support | ||||||
!regexList.filterNot(_ == "\u0000").exists(pattern => strLit.contains(pattern)) | ||||||
isSupportedStringReplacePattern(strLit) | ||||||
} | ||||||
case _ => false | ||||||
} | ||||||
|
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
Oops, something went wrong.
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, here and other places, could use typed constants