You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/02/08 23:32:36 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27502: [SPARK-30759][SQL] Initialize cache for foldable patterns in StringRegexExpression

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:
users@infra.apache.org


With regards,
Apache Git Services

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