Github user wangyum commented on a diff in the pull request:

    https://github.com/apache/spark/pull/23028#discussion_r233317201
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
 ---
    @@ -504,6 +504,19 @@ object LikeSimplification extends Rule[LogicalPlan] {
                 Like(input, Literal.create(pattern, StringType))
             }
           }
    +
    +    case Like(Literal(pattern, StringType), input) =>
    +      if (pattern == null) {
    +        // If pattern is null, return null value directly, since "null 
like col" == null.
    +        Literal(null, BooleanType)
    +      } else {
    +        pattern.toString match {
    +          case equalTo(str) =>
    +            EqualTo(Literal(str), input)
    --- End diff --
    
    Yes. 
    ```
    select  "abc" like "%abc%" -> true
    ```


---

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

Reply via email to