spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wenchen Fan (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (SPARK-17647) SQL LIKE does not handle backslashes correctly
Date Wed, 20 Dec 2017 13:06:01 GMT

    [ https://issues.apache.org/jira/browse/SPARK-17647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16298456#comment-16298456
] 

Wenchen Fan edited comment on SPARK-17647 at 12/20/17 1:05 PM:
---------------------------------------------------------------

{{{
spark.sql("select '\\\\' like '%\\%'").show
}}}
actually is
{{{
select '\\' like '%\%
}}}
as SQL statement, after the java string escaping.


was (Author: cloud_fan):
{
spark.sql("select '\\\\' like '%\\%'").show
} actually is
{
select '\\' like '%\%
}
as SQL statement, after the java string escaping.

> SQL LIKE does not handle backslashes correctly
> ----------------------------------------------
>
>                 Key: SPARK-17647
>                 URL: https://issues.apache.org/jira/browse/SPARK-17647
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Xiangrui Meng
>            Assignee: Xiangrui Meng
>              Labels: correctness
>             Fix For: 2.1.1, 2.2.0
>
>
> Try the following in SQL shell:
> {code}
> select '\\\\' like '%\\%';
> {code}
> It returned false, which is wrong.
> cc: [~yhuai] [~joshrosen]
> A false-negative considered previously:
> {code}
> select '\\\\' rlike '.*\\\\\\\\.*';
> {code}
> It returned true, which is correct if we assume that the pattern is treated as a Java
string but not raw string.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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


Mime
View raw message