[ 
https://issues.apache.org/jira/browse/SPARK-38168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dooyoung Hwang resolved SPARK-38168.
------------------------------------
    Resolution: Won't Fix

> LikeSimplification handles escape character
> -------------------------------------------
>
>                 Key: SPARK-38168
>                 URL: https://issues.apache.org/jira/browse/SPARK-38168
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.2.0, 3.3.0
>            Reporter: Dooyoung Hwang
>            Priority: Major
>
> Currently, LikeSimplification rule of catalyst is skipped if the pattern 
> contains escape character.
> {noformat}
> SELECT * FROM tbl LIKE '%100\%'
> ...
> == Optimized Logical Plan ==
> Filter (isnotnull(c_1#0) && c_1#0 LIKE %100\%)
> +- Relation[c_1#0,c_2#1,c_3#2] ...
> {noformat}
> The filter LIKE '%100\%' in this query is not optimized into 'EndsWith' of 
> StringType.
> LikeSimplification rule can consider a special character(wildcard(%, _) or 
> escape character) as a plain character if the character follows an escape 
> character.
> By doing that, LikeSimplification rule can optimize the filter like below.
> {noformat}
> SELECT * FROM tbl LIKE '%100\%'
> ...
> == Optimized Logical Plan ==
> Filter (isnotnull(c_1#0) && EndsWith(c_1#0, 100%))
> +- Relation[c_1#0,c_2#1,c_3#2] 
> {noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to