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 2019/05/14 16:06:52 UTC

[GitHub] [spark] Achuth17 commented on a change in pull request #24583: [SPARK-27679][SQL] Improve LIKE optimization

Achuth17 commented on a change in pull request #24583: [SPARK-27679][SQL] Improve LIKE optimization
URL: https://github.com/apache/spark/pull/24583#discussion_r283880762
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
 ##########
 @@ -479,12 +479,15 @@ object LikeSimplification extends Rule[LogicalPlan] {
   private val startsAndEndsWith = "([^_%]+)%([^_%]+)".r
   private val contains = "%([^_%]+)%".r
   private val equalTo = "([^_%]*)".r
+  private val endsWithUnderscore = "([^_%]+)_".r
+  private val startsWithUnderscore = "_([^_%]+)".r
+  private val startsAndEndsWithUnderscore = "([^_%]+)_([^_%]+)".r
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transformAllExpressions {
     case Like(input, Literal(pattern, StringType)) =>
       if (pattern == null) {
         // If pattern is null, return null value directly, since "col like null" == null.
-        Literal(null, BooleanType)
+        Literal(false, BooleanType)
 
 Review comment:
   I was planning on changing `like null` to `like false` so that we can change the underlying table read but I realized that `like null` is a valid check. I will revert this.

----------------------------------------------------------------
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