-
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
Support some escape chars when rewriting regexp_replace to stringReplace #11813
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -593,8 +593,9 @@ object GpuOverrides extends Logging { | |
} | ||
|
||
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)) | ||
// check for regex special characters, except for \u0000, \n, \r, and \t which we can support | ||
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. Just out of curiosity is there a reason we cannot support all \uXXXX escaped characters? It is just replaced with a unicode character and we should be able to do that directly. 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. This line is to filter out regex special characters that can be replaced, normal utf8 characters are not in this list and are already supported. |
||
val supported = Seq("\u0000", "\n", "\r", "\t") | ||
!regexList.filterNot(supported.contains(_)).exists(pattern => strLit.contains(pattern)) | ||
} | ||
|
||
def isSupportedStringReplacePattern(exp: Expression): Boolean = { | ||
|
@@ -605,7 +606,6 @@ object GpuOverrides extends Logging { | |
if (strLit.isEmpty) { | ||
false | ||
} else { | ||
// check for regex special characters, except for \u0000 which we can support | ||
isSupportedStringReplacePattern(strLit) | ||
} | ||
case _ => false | ||
|
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:
spark-rapids/sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuOverrides.scala
Line 609 in b48335a
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.
Deleted this comment as it is duplicated and intended to describe the internal logic of this function.