You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (Jira)" <ji...@apache.org> on 2022/02/09 15:00:00 UTC

[jira] [Assigned] (SPARK-38168) LikeSimplification handles escape character

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

Apache Spark reassigned SPARK-38168:
------------------------------------

    Assignee: Apache Spark

> 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
>            Assignee: Apache Spark
>            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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org