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

Carl Steinbach commented on HIVE-2594:
--------------------------------------


UDFLike does not correctly handle patterns where an escaped '\' precedes '%':

{noformat}
% cat /home/carl/Work/repos/hive-test/data/files/pattern/*
aaaaaa
aaa\bbb
aaa\\ccc
aaa\\\ddd
aaa%aaa

% hive

hive> CREATE TABLE test (a STRING)
      STORED AS TEXTFILE
      LOCATION '/home/carl/Work/repos/hive-test/data/files/pattern';

OK

hive> SELECT * FROM test;
OK
aaaaaa
aaa\bbb
aaa\\ccc
aaa\\\ddd
aaa%aaa

hive> SELECT * FROM test WHERE a LIKE 'aaa%'; -- Should match everything. WORKS!
OK
aaaaaa
aaa\bbb
aaa\\ccc
aaa\\\ddd
aaa%aaa

hive> SELECT * from test WHERE a LIKE 'aaa\%%'; -- Should match 'aaa%aaa'. 
WORKS!
OK
aaa%aaa

hive> SELECT * FROM test WHERE a LIKE 'aaa\\%'; -- Should match 'aaa\bbb', 
'aaa\\ccc', and 'aaa\\\ddd'. FAILURE!
OK

hive> SELECT * FROM test WHERE a LIKE 'aaa\\b%'; -- Should match 'aaa\bbb'. 
Works!
OK
aaa\bbb

hive> quit;
{noformat}



                
> UDF LIKE can't handle literal '\' before '%'
> --------------------------------------------
>
>                 Key: HIVE-2594
>                 URL: https://issues.apache.org/jira/browse/HIVE-2594
>             Project: Hive
>          Issue Type: Bug
>          Components: UDF
>    Affects Versions: 0.8.0
>            Reporter: Carl Steinbach
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to