You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Josh Rosen (JIRA)" <ji...@apache.org> on 2016/09/23 21:53:20 UTC

[jira] [Comment Edited] (SPARK-17647) SQL LIKE/RLIKE do not handle backslashes correctly

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

Josh Rosen edited comment on SPARK-17647 at 9/23/16 9:52 PM:
-------------------------------------------------------------

Another piece of evidence to help untangle this:

In MySQL,

{code}
select '\\' like '\\', '\\' rlike '\\\\';
{code}

returns {{true}} for both columns, illustrating that {{like}} and {{rlike}} seem to have different escaping rules.

However,

{code}
select 
  '\\' like '\\\\',
  '\\' like '\\'
{code}

returns {{true}} for both columns in MySQL and {{true, false}} in Postgres.


was (Author: joshrosen):
Another piece of evidence to help untangle this:

In MySQL,

{code}
select '\\' like '\\', '\\' rlike '\\\\';
{code}

returns {{true}} for both columns, illustrating that {{like}} and {{rlike}} seem to have different escaping rules.

> SQL LIKE/RLIKE do 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
>              Labels: correctness
>
> Try the following in SQL shell:
> {code}
> select '\\\\' like '%\\%';
> select '\\\\' rlike '.*\\\\\\\\.*';
> {code}
> The first returned false and the second returned true. Both are wrong.
> cc: [~yhuai] [~joshrosen]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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