dongjoon-hyun commented on a change in pull request #27502: [SPARK-30759][SQL]
Initialize cache for foldable patterns in StringRegexExpression
URL: https://github.com/apache/spark/pull/27502#discussion_r376741391
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/regexpExpressions.scala
##########
@@ -41,10 +41,12 @@ trait StringRegexExpression extends Expression
override def dataType: DataType = BooleanType
- // try cache the pattern for Literal
+ // try cache foldable pattern
private lazy val cache: Pattern = pattern match {
- case Literal(value: String, StringType) => compile(value)
- case _ => null
+ case p: Expression if p.foldable =>
Review comment:
This will consider `'a' + 'b'` from now. I prefer to consider SPARK-30759 as
a performance improvement and merge to `master` only.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]