I just confirmed that for Hive v0.10 (and probably all versions)  "foobar"
rlike "foo" returns true, just to be clear. In other words, the Java
regular expression does NOT have to match the whole string.

The wiki should be changed. If someone wants to give me permission, I'll do
it ;)

dean

On Fri, Aug 9, 2013 at 7:02 PM, Lefty Leverenz <leftylever...@gmail.com>wrote:

> 1) Did you miss the first word?  ("NULL if A or B is NULL")
> 2) Darren Yin posted a similar message to the user 
> list<http://mail-archives.apache.org/mod_mbox/hive-user/201308.mbox/%3cCAPWDJtUZRaPgeP=0xnsbaos7+154a978wz1omkazqg-jmuf...@mail.gmail.com%3e>on
>  August 1st (or July 31st in some time zones):
>
> ============
> from here:
> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-RelationalOperators
>  A RLIKE B strings NULL if A or B is NULL, TRUE if any (possibly empty)
> substring of A matches the Java regular expression B, otherwise FALSE. E.g.
> 'foobar' RLIKE 'foo' evaluates to FALSE whereas 'foobar' RLIKE '^f.*r$'
> evaluates to TRUE.
> 'foobar' RLIKE 'foo' evaluates to TRUE doesn't it?
> ============
>
>
> The page history shows this:
>
> *June 24, 2011 (first version, unchanged until July 4 this year):*
> NULL if A or B is NULL, TRUE if string A matches the Java regular
> expression B(See Java regular expressions syntax), otherwise FALSE e.g.
> 'foobar' rlike 'foo' evaluates to FALSE where as 'foobar' rlike '^f.*r$'
> evaluates to TRUE
>
> *July 4, 2013 (version 47 changed by Siyang 
> Chen<https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=27362046&selectedPageVersions=47&selectedPageVersions=46>
> )*
> NULL if A or B is NULL, TRUE if any (possibly empty) substring of A
> matches the Java regular expression B, otherwise FALSE. E.g. 'foobar' RLIKE
> 'foo' evaluates to FALSE whereas 'foobar' RLIKE '^f.*r$' evaluates to TRUE.
>
>
> -- Lefty Leverenz
>
>
>
> On Thu, Aug 8, 2013 at 7:28 PM, Sergey Shelukhin 
> <ser...@hortonworks.com>wrote:
>
>> Double checking before I try to edit.
>>
>> The page here:
>> https://cwiki.apache.org/Hive/languagemanual-udf.html
>>
>> says:
>>
>> A RLIKE B
>>  if A or B is NULL, TRUE if any (possibly empty) substring of A
>> matches the Java regular expression B, otherwise FALSE. E.g. 'foobar'
>> RLIKE 'foo' evaluates to FALSE whereas 'foobar' RLIKE '^f.*r$'
>> evaluates to TRUE.
>>
>> 1) "if A or B is NULL" seems like an unfinished part.
>> 2) "any (possibly empty) substring of A [that] matches the Java
>> regular expression B" should be "foo" at 0 for 'foobar' RLIKE 'foo',
>> and result in TRUE, right?
>>
>
>
>
> --
> Lefty
>



-- 
Dean Wampler, Ph.D.
@deanwampler
http://polyglotprogramming.com

Reply via email to