You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Tim Armstrong (Jira)" <ji...@apache.org> on 2021/01/09 01:42:01 UTC
[jira] [Commented] (IMPALA-3941) regexp_replace Can Swallow Odd
Quotes
[ https://issues.apache.org/jira/browse/IMPALA-3941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17261712#comment-17261712 ]
Tim Armstrong commented on IMPALA-3941:
---------------------------------------
{noformat}
[localhost.EXAMPLE.COM:21050] default> select regexp_replace("It's a bad test\'s day", "\\\\'", "'")
;
Query: select regexp_replace("It's a bad test\'s day", "\\\\'", "'")
Query submitted at: 2021-01-08 17:40:23 (Coordinator: http://tarmstrong-box2:25000)
Query progress can be monitored at: http://tarmstrong-box2:25000/query_plan?query_id=05464a21e771d52
a:6a6df85800000000
+-----------------------------------------------------------+
| regexp_replace('it\'s a bad test\'s day', '\\\\\'', '\'') |
+-----------------------------------------------------------+
| It's a bad test's day |
+-----------------------------------------------------------+
Fetched 1 row(s) in 0.12s
[localhost.EXAMPLE.COM:21050] default> select regexp_replace("It's a bad test's day", "\\\\'", "'")
> ;
Query: select regexp_replace("It's a bad test's day", "\\\\'", "'")
Query submitted at: 2021-01-08 17:40:42 (Coordinator: http://tarmstrong-box2:25000)
Query progress can be monitored at: http://tarmstrong-box2:25000/query_plan?query_id=7149f2cfc0e6668
7:a5b29c3700000000
+-----------------------------------------------------------+
| regexp_replace('it\'s a bad test\'s day', '\\\\\'', '\'') |
+-----------------------------------------------------------+
| It's a bad test's day |
+-----------------------------------------------------------+
Fetched 1 row(s) in 0.12s
[localhost.EXAMPLE.COM:21050] default> select regexp_replace("It\'s a bad test\'s day", "\\\\'", "'"
)
> ;
Query: select regexp_replace("It\'s a bad test\'s day", "\\\\'", "'")
Query submitted at: 2021-01-08 17:41:01 (Coordinator: http://tarmstrong-box2:25000)
Query progress can be monitored at: http://tarmstrong-box2:25000/query_plan?query_id=904786bc2d94035
b:5e9fbf8900000000
+-----------------------------------------------------------+
| regexp_replace('it\'s a bad test\'s day', '\\\\\'', '\'') |
+-----------------------------------------------------------+
| It's a bad test's day |
+-----------------------------------------------------------+
Fetched 1 row(s) in 0.12s
[localhost.EXAMPLE.COM:21050] default>
{noformat}
> regexp_replace Can Swallow Odd Quotes
> -------------------------------------
>
> Key: IMPALA-3941
> URL: https://issues.apache.org/jira/browse/IMPALA-3941
> Project: IMPALA
> Issue Type: Bug
> Components: Backend
> Affects Versions: Impala 2.6.0
> Reporter: Alan Jackoway
> Priority: Minor
>
> We were trying to remove an escape character in front of a single quote using regexp_replace.
> When testing our regexp, we wanted to make sure it wouldn't knock out non-escaped quotes. That led us to this odd case:
> {code:sql}
> Query: select regexp_replace("It's a bad test\'s day", "\\\\'", "'")
> +--------------------------------------------------------+
> | regexp_replace('it's a bad test\'s day', '\\\\'', ''') |
> +--------------------------------------------------------+
> | Its day |
> +--------------------------------------------------------+
> {code}
> That only seems to happen when we mix single quotes with escaped quotes. If all the quotes are escaped it works. Here's a few more interesting cases:
> {code:sql}
> Query: select regexp_replace("It's a bad test's day", "\\\\'", "'")
> +-------------------------------------------------------+
> | regexp_replace('it's a bad test's day', '\\\\'', ''') |
> +-------------------------------------------------------+
> | Its day |
> +-------------------------------------------------------+
> Query: select regexp_replace("It\'s a bad test\'s day", "\\\\'", "'")
> +---------------------------------------------------------+
> | regexp_replace('it\'s a bad test\'s day', '\\\\'', ''') |
> +---------------------------------------------------------+
> | It's a bad test's day |
> +---------------------------------------------------------+
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org