Skip to content

Commit

Permalink
Fall to cpu when && found in character class (#5658)
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony Chang <antchang@nvidia.com>
  • Loading branch information
anthony-chang authored May 26, 2022
1 parent e2b3e00 commit 4144c3d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ class RegexParser(pattern: String) {
RegexEscaped(ch)
case other => other
}
case '&' =>
peek() match {
case Some('&') =>
throw new RegexUnsupportedException("" +
"cuDF does not support class intersection operator &&", Some(pos))
case _ => // ignore
}
RegexChar('&')
case ch =>
RegexChar(ch)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ class RegularExpressionTranspilerSuite extends FunSuite with Arm {
"cuDF does not support null characters in regular expressions"))
}

test("cuDF does not support class intersection &&") {
val patterns = Seq("[a&&b]", "[&&1]")
patterns.foreach(pattern =>
assertUnsupported(pattern, RegexFindMode,
"cuDF does not support class intersection operator &&"))

assertCpuGpuMatchesRegexpReplace(Seq("a&&b", "[a&b&c]"), Seq("a&&b", "b&c"))
}

test("octal digits - find") {
val patterns = Seq(raw"\07", raw"\077", raw"\0177", raw"\01772", raw"\0200",
raw"\0376", raw"\0377", raw"\02002")
Expand Down

0 comments on commit 4144c3d

Please sign in to comment.