Support Questions
Find answers, ask questions, and share your expertise

Hive - Regexp/RLIKE using a cast string variable?

Highlighted

Hive - Regexp/RLIKE using a cast string variable?

Explorer

Hi,

 

I'm trying to use an regexp match expression which checks the length of a casted string:

 

 

 

select num_string 
from
(SELECT number,cast(number as string) as num_string
from table A) as a
where num_string RLIKE "^\d{1,3}$";

 

 

 

 
However, this does not work. It does not return me any values. It looks like my  where statement does not consider the casted string variable correctly into account.


I know, I could just use a length statement, but I need this kind of check for a more complex regex expression where lenght wouldn't work.

Any idea? 

Thanks,

 

KS