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/13 09:28:05 UTC
[GitHub] [spark] mgaido91 commented on a change in pull request #24583:
[SPARK-27679][SQL] Improve LIKE optimization
mgaido91 commented on a change in pull request #24583: [SPARK-27679][SQL] Improve LIKE optimization
URL: https://github.com/apache/spark/pull/24583#discussion_r283256869
##########
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:
why did you change 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