Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/7561#discussion_r35902989
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringOperations.scala
---
@@ -196,6 +208,34 @@ case class RLike(left: Expression, right: Expression)
override def escape(v: String): String = v
override def matches(regex: Pattern, str: String): Boolean =
regex.matcher(str).find(0)
override def toString: String = s"$left RLIKE $right"
+
+ override protected def genCode(ctx: CodeGenContext, ev:
GeneratedExpressionCode): String = {
+ val patternClass = classOf[Pattern].getName
+ val pattern = ctx.freshName("pattern")
+
+ nullSafeCodeGen(ctx, ev, (eval1, eval2) => {
+ val patternCode =
+ if (right.foldable) {
--- End diff --
I think we should move this out of `nullSafeCodeGen`, or it will also eval
the `eval2`.
```
if (right.foldable) {
val rVal = right.eval()
if (rVal != null) {
} else {
"boolean {ev.isNull} = true; xxx"
}
} else {
nullSafeCodeGen(xxx)
}
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]