You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "yaooqinn (via GitHub)" <gi...@apache.org> on 2023/08/22 14:03:57 UTC

[GitHub] [spark] yaooqinn commented on a diff in pull request #42601: [SPARK-44905][SQL] Stateful lastRegex causes NullPointerException on eval for regexp_replace

yaooqinn commented on code in PR #42601:
URL: https://github.com/apache/spark/pull/42601#discussion_r1301702033


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/regexpExpressions.scala:
##########
@@ -637,14 +637,9 @@ case class RegExpReplace(subject: Expression, regexp: Expression, rep: Expressio
 
   override def nullSafeEval(s: Any, p: Any, r: Any, i: Any): Any = {
     if (!p.equals(lastRegex)) {
-      // regex value changed
-      lastRegex = p.asInstanceOf[UTF8String].clone()
-      try {
-        pattern = Pattern.compile(lastRegex.toString)

Review Comment:
   Yeah. They shall be updated at the same time. Exprs like regexp_extract/regexp_extract_all once had the same issue but has been fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org