You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "holdenk (via GitHub)" <gi...@apache.org> on 2026/02/18 21:54:16 UTC
Re: [PR] [SPARK-47672][SQL] Avoid double eval from filter pushDown w/ projection pushdown [spark]
holdenk commented on code in PR #46143:
URL: https://github.com/apache/spark/pull/46143#discussion_r2824645581
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/regexpExpressions.scala:
##########
@@ -83,6 +83,27 @@ abstract class StringRegexExpression extends BinaryExpression
matches(regex, input1.asInstanceOf[UTF8String].toString)
}
}
+
+ override def expensive: Boolean = hasExpensiveChild || _expensiveRegex
+
+ private lazy val _expensiveRegex = {
+ // A quick heuristic for expensive a pattern is.
+ left match {
+ case StringLiteral(str) =>
+ // If we have a clear start limited back tracking required.
+ if (str.startsWith("^") || str.startsWith("\\b")) {
+ false
+ } else if (str.contains("+")) {
+ // Greedy matching can be tricky.
Review Comment:
Fair point, we can extend that
--
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