venkata91 commented on a change in pull request #24583: [SPARK-27679][SQL]
Improve LIKE optimization
URL: https://github.com/apache/spark/pull/24583#discussion_r283070528
##########
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 containsSingleUnderscore = "([^_%]+)_([^_%]+)".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.
Review comment:
Need to fix this comment? Why null is not a valid pattern?
----------------------------------------------------------------
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]