You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Ramya S <ra...@suntecgroup.com> on 2014/05/29 14:05:51 UTC

Pattern Matching using Phoenix

 
Hi,
 
Im using phoenix-2.2.2 on Apache hadoop-1.0.4. 
 
Does phoenix support REGEXP operator or is there any equivalent operator for pattern matching using phoenix.
 
Please help to solve  the same.
 
 
Thanks & Regards
 
Ramya.S 
 

Re: LIKE operator in Phoenix

Posted by James Taylor <ja...@apache.org>.
Try this as a workaround:

select * from account_service_history  where TO_CHAR(ash_id) LIKE  '217%'

Thanks,
James

On Mon, Jun 9, 2014 at 10:28 AM, James Taylor <ja...@apache.org> wrote:
> Please file a JIRA here: https://issues.apache.org/jira/browse/PHOENIX
> and include the query plus your create table statement.
> Thanks,
> James
>
> On Mon, Jun 9, 2014 at 1:33 AM, Ramya S <ra...@suntecgroup.com> wrote:
>>
>> Tried the same query using  CAST but it shows type mismatch error as  : Type mismatch. INTEGER and VARCHAR for ASH_ID
>>
>> Please help to solve...
>>
>>
>>
>> Thanks
>> Ramya.S
>>
>>
>> ________________________________
>>
>> From: James Taylor [mailto:jamestaylor@apache.org]
>> Sent: Mon 6/9/2014 10:46 AM
>> To: user
>> Subject: Re: LIKE operator in Phoenix
>>
>>
>>
>> You can do the following instead:
>>
>> select * from account_service_history  where CAST(ash_id AS VARCHAR)
>> LIKE  '217%';
>>
>> If this is a common operation, might be better to use VARCHAR instead
>> of INTEGER for your column type.
>>
>> Thanks,
>> James
>>
>> On Sun, Jun 8, 2014 at 10:08 PM, Ramya S <ra...@suntecgroup.com> wrote:
>>> Hi,
>>>
>>>
>>> Consider the below query as an example, where the ASH_ID column is INTEGER type.
>>>
>>> select * from account_service_history  where ash_id LIKE  '217%';
>>>
>>>
>>> While firing such a query in phoenix gives a type mismatch error.
>>>
>>> Does phoenix handles  type cast of Integer/Double to a string  internally?
>>>
>>>
>>>
>>> Thanks
>>>
>>> Ramya.S
>>>
>>>
>>> ________________________________
>>>
>>> From: James Taylor [mailto:jamestaylor@apache.org]
>>> Sent: Mon 6/9/2014 9:48 AM
>>> To: user
>>> Subject: Re: LIKE operator in Phoenix
>>>
>>>
>>>
>>> Can you give an example of what you mean? LIKE is for strings, but you
>>> can cast an Integer/Double to a string.
>>>
>>> Thanks,
>>> James
>>>
>>> On Sun, Jun 8, 2014 at 9:02 PM, Ramya S <ra...@suntecgroup.com> wrote:
>>>>
>>>>
>>>> Does the LIKE operator in phoenix support  Integer/Double  column values ?
>>>>
>>>>
>>>>
>>>> Thanks
>>>> Ramya.S
>>>>
>>>>
>>>
>>>
>>
>>

Re: LIKE operator in Phoenix

Posted by James Taylor <ja...@apache.org>.
Please file a JIRA here: https://issues.apache.org/jira/browse/PHOENIX
and include the query plus your create table statement.
Thanks,
James

On Mon, Jun 9, 2014 at 1:33 AM, Ramya S <ra...@suntecgroup.com> wrote:
>
> Tried the same query using  CAST but it shows type mismatch error as  : Type mismatch. INTEGER and VARCHAR for ASH_ID
>
> Please help to solve...
>
>
>
> Thanks
> Ramya.S
>
>
> ________________________________
>
> From: James Taylor [mailto:jamestaylor@apache.org]
> Sent: Mon 6/9/2014 10:46 AM
> To: user
> Subject: Re: LIKE operator in Phoenix
>
>
>
> You can do the following instead:
>
> select * from account_service_history  where CAST(ash_id AS VARCHAR)
> LIKE  '217%';
>
> If this is a common operation, might be better to use VARCHAR instead
> of INTEGER for your column type.
>
> Thanks,
> James
>
> On Sun, Jun 8, 2014 at 10:08 PM, Ramya S <ra...@suntecgroup.com> wrote:
>> Hi,
>>
>>
>> Consider the below query as an example, where the ASH_ID column is INTEGER type.
>>
>> select * from account_service_history  where ash_id LIKE  '217%';
>>
>>
>> While firing such a query in phoenix gives a type mismatch error.
>>
>> Does phoenix handles  type cast of Integer/Double to a string  internally?
>>
>>
>>
>> Thanks
>>
>> Ramya.S
>>
>>
>> ________________________________
>>
>> From: James Taylor [mailto:jamestaylor@apache.org]
>> Sent: Mon 6/9/2014 9:48 AM
>> To: user
>> Subject: Re: LIKE operator in Phoenix
>>
>>
>>
>> Can you give an example of what you mean? LIKE is for strings, but you
>> can cast an Integer/Double to a string.
>>
>> Thanks,
>> James
>>
>> On Sun, Jun 8, 2014 at 9:02 PM, Ramya S <ra...@suntecgroup.com> wrote:
>>>
>>>
>>> Does the LIKE operator in phoenix support  Integer/Double  column values ?
>>>
>>>
>>>
>>> Thanks
>>> Ramya.S
>>>
>>>
>>
>>
>
>

RE: LIKE operator in Phoenix

Posted by Ramya S <ra...@suntecgroup.com>.
 
Tried the same query using  CAST but it shows type mismatch error as  : Type mismatch. INTEGER and VARCHAR for ASH_ID
 
Please help to solve...
 
 
 
Thanks 
Ramya.S 
 

________________________________

From: James Taylor [mailto:jamestaylor@apache.org]
Sent: Mon 6/9/2014 10:46 AM
To: user
Subject: Re: LIKE operator in Phoenix



You can do the following instead:

select * from account_service_history  where CAST(ash_id AS VARCHAR)
LIKE  '217%';

If this is a common operation, might be better to use VARCHAR instead
of INTEGER for your column type.

Thanks,
James

On Sun, Jun 8, 2014 at 10:08 PM, Ramya S <ra...@suntecgroup.com> wrote:
> Hi,
>
>
> Consider the below query as an example, where the ASH_ID column is INTEGER type.
>
> select * from account_service_history  where ash_id LIKE  '217%';
>
>
> While firing such a query in phoenix gives a type mismatch error.
>
> Does phoenix handles  type cast of Integer/Double to a string  internally?
>
>
>
> Thanks
>
> Ramya.S
>
>
> ________________________________
>
> From: James Taylor [mailto:jamestaylor@apache.org]
> Sent: Mon 6/9/2014 9:48 AM
> To: user
> Subject: Re: LIKE operator in Phoenix
>
>
>
> Can you give an example of what you mean? LIKE is for strings, but you
> can cast an Integer/Double to a string.
>
> Thanks,
> James
>
> On Sun, Jun 8, 2014 at 9:02 PM, Ramya S <ra...@suntecgroup.com> wrote:
>>
>>
>> Does the LIKE operator in phoenix support  Integer/Double  column values ?
>>
>>
>>
>> Thanks
>> Ramya.S
>>
>>
>
>



Re: LIKE operator in Phoenix

Posted by James Taylor <ja...@apache.org>.
You can do the following instead:

select * from account_service_history  where CAST(ash_id AS VARCHAR)
LIKE  '217%';

If this is a common operation, might be better to use VARCHAR instead
of INTEGER for your column type.

Thanks,
James

On Sun, Jun 8, 2014 at 10:08 PM, Ramya S <ra...@suntecgroup.com> wrote:
> Hi,
>
>
> Consider the below query as an example, where the ASH_ID column is INTEGER type.
>
> select * from account_service_history  where ash_id LIKE  '217%';
>
>
> While firing such a query in phoenix gives a type mismatch error.
>
> Does phoenix handles  type cast of Integer/Double to a string  internally?
>
>
>
> Thanks
>
> Ramya.S
>
>
> ________________________________
>
> From: James Taylor [mailto:jamestaylor@apache.org]
> Sent: Mon 6/9/2014 9:48 AM
> To: user
> Subject: Re: LIKE operator in Phoenix
>
>
>
> Can you give an example of what you mean? LIKE is for strings, but you
> can cast an Integer/Double to a string.
>
> Thanks,
> James
>
> On Sun, Jun 8, 2014 at 9:02 PM, Ramya S <ra...@suntecgroup.com> wrote:
>>
>>
>> Does the LIKE operator in phoenix support  Integer/Double  column values ?
>>
>>
>>
>> Thanks
>> Ramya.S
>>
>>
>
>

RE: LIKE operator in Phoenix

Posted by Ramya S <ra...@suntecgroup.com>.
Hi,
 
 
Consider the below query as an example, where the ASH_ID column is INTEGER type. 
 
select * from account_service_history  where ash_id LIKE  '217%';
 
 
While firing such a query in phoenix gives a type mismatch error. 
 
Does phoenix handles  type cast of Integer/Double to a string  internally?

 

Thanks

Ramya.S


________________________________

From: James Taylor [mailto:jamestaylor@apache.org]
Sent: Mon 6/9/2014 9:48 AM
To: user
Subject: Re: LIKE operator in Phoenix



Can you give an example of what you mean? LIKE is for strings, but you
can cast an Integer/Double to a string.

Thanks,
James

On Sun, Jun 8, 2014 at 9:02 PM, Ramya S <ra...@suntecgroup.com> wrote:
>
>
> Does the LIKE operator in phoenix support  Integer/Double  column values ?
>
>
>
> Thanks
> Ramya.S
>
>



Re: LIKE operator in Phoenix

Posted by James Taylor <ja...@apache.org>.
Can you give an example of what you mean? LIKE is for strings, but you
can cast an Integer/Double to a string.

Thanks,
James

On Sun, Jun 8, 2014 at 9:02 PM, Ramya S <ra...@suntecgroup.com> wrote:
>
>
> Does the LIKE operator in phoenix support  Integer/Double  column values ?
>
>
>
> Thanks
> Ramya.S
>
>

LIKE operator in Phoenix

Posted by Ramya S <ra...@suntecgroup.com>.
 
 
Does the LIKE operator in phoenix support  Integer/Double  column values ?
 
 
 
Thanks 
Ramya.S 
 
 

RE: Pattern Matching using Phoenix

Posted by Ramya S <ra...@suntecgroup.com>.
 
Yeah, sure i will try....
 
Does the LIKE operator in phoenix support  Integer/Double  column values to be checked?
 
 
 
Thanks 
Ramya.S 
 
 

________________________________

From: James Taylor [mailto:jamestaylor@apache.org]
Sent: Sat 5/31/2014 10:33 AM
To: user@phoenix.incubator.apache.org
Subject: Re: Pattern Matching using Phoenix


Our functions are listed here: http://phoenix.incubator.apache.org/language/functions.html#regexp_replace 

We have LIKE, but not REGEXP_LIKE. Maybe you can contribute it - it's pretty easy? There's a step by step guide here: http://phoenix-hbase.blogspot.com/2013/04/how-to-add-your-own-built-in-function.html

Thanks,
James


On Thu, May 29, 2014 at 10:41 PM, Ramya S <ra...@suntecgroup.com> wrote:


	Thanks alot...
	
	But im looking for REGEXP funtion that matches a column value with a particular pattern.
	
	 For eg:
	       WHERE (REGEXP_LIKE(patient_phone, '^\([[:digit:]]{3}\) [[:digit:]]{3}-[[:digit:]]{4}$')));
	
	Is that possible with phoenix?
	
	Ramya.S
	
	________________________________
	
	From: Andrew [mailto:al@starfishzone.com]
	Sent: Thu 5/29/2014 7:19 PM
	To: user@phoenix.incubator.apache.org
	Subject: Re: Pattern Matching using Phoenix
	


	Yes, please see:
	http://phoenix.incubator.apache.org/language/functions.html#regexp_substr
	
	On 29/05/2014 13:05, Ramya S wrote:
	
	
	
	        Hi,
	
	        Im using phoenix-2.2.2 on Apache hadoop-1.0.4.
	
	        Does phoenix support REGEXP operator or is there any equivalent operator for pattern matching using phoenix.
	
	
	        Please help to solve  the same.
	
	
	
	
	        Thanks & Regards
	
	        Ramya.S
	
	
	
	



Re: FW: Pattern Matching using Phoenix

Posted by James Taylor <ja...@apache.org>.
Hi Ramya,
Built-in functions must be included in the phoenix jar. We have an
open JIRA for supporting dynamically loaded built-in functions, but
until HBase has a way to sandbox coprocessor code, it's likely too
risky to support.

If you open a JIRA and provide a patch, we can include it in our next
patch release.

Thanks,
James

On Mon, Jun 16, 2014 at 8:50 AM, Ramya S <ra...@suntecgroup.com> wrote:
>
>
> Hi
>
>
> I followed the steps to add the new built-in-funtion REGEXP_LIKE,   but how can i register this function outside of the phoenix jar?
>
> Could anyone share the ways to test the user-defined funtion without building the phoenix jar?
>
> Please do reply
>
>
> Thanks
> Ramya.S
>
>
>
> ________________________________
>
> From: James Taylor [mailto:jamestaylor@apache.org]
> Sent: Sat 5/31/2014 10:33 AM
> To: user@phoenix.incubator.apache.org
> Subject: Re: Pattern Matching using Phoenix
>
>
> Our functions are listed here: http://phoenix.incubator.apache.org/language/functions.html#regexp_replace
>
> We have LIKE, but not REGEXP_LIKE. Maybe you can contribute it - it's pretty easy? There's a step by step guide here: http://phoenix-hbase.blogspot.com/2013/04/how-to-add-your-own-built-in-function.html
>
> Thanks,
> James
>
>
> On Thu, May 29, 2014 at 10:41 PM, Ramya S <ra...@suntecgroup.com> wrote:
>
>
>         Thanks alot...
>
>         But im looking for REGEXP funtion that matches a column value with a particular pattern.
>
>          For eg:
>                WHERE (REGEXP_LIKE(patient_phone, '^\([[:digit:]]{3}\) [[:digit:]]{3}-[[:digit:]]{4}$')));
>
>         Is that possible with phoenix?
>
>         Ramya.S
>
>         ________________________________
>
>         From: Andrew [mailto:al@starfishzone.com]
>         Sent: Thu 5/29/2014 7:19 PM
>         To: user@phoenix.incubator.apache.org
>         Subject: Re: Pattern Matching using Phoenix
>
>
>
>         Yes, please see:
>         http://phoenix.incubator.apache.org/language/functions.html#regexp_substr
>
>         On 29/05/2014 13:05, Ramya S wrote:
>
>
>
>                 Hi,
>
>                 Im using phoenix-2.2.2 on Apache hadoop-1.0.4.
>
>                 Does phoenix support REGEXP operator or is there any equivalent operator for pattern matching using phoenix.
>
>
>                 Please help to solve  the same.
>
>
>
>
>                 Thanks & Regards
>
>                 Ramya.S
>
>
>
>
>
>

FW: Pattern Matching using Phoenix

Posted by Ramya S <ra...@suntecgroup.com>.
 
Hi
 
 
I followed the steps to add the new built-in-funtion REGEXP_LIKE,   but how can i register this function outside of the phoenix jar?
 
Could anyone share the ways to test the user-defined funtion without building the phoenix jar?
 
Please do reply
 
 
Thanks 
Ramya.S 
 
 

________________________________

From: James Taylor [mailto:jamestaylor@apache.org]
Sent: Sat 5/31/2014 10:33 AM
To: user@phoenix.incubator.apache.org
Subject: Re: Pattern Matching using Phoenix


Our functions are listed here: http://phoenix.incubator.apache.org/language/functions.html#regexp_replace 

We have LIKE, but not REGEXP_LIKE. Maybe you can contribute it - it's pretty easy? There's a step by step guide here: http://phoenix-hbase.blogspot.com/2013/04/how-to-add-your-own-built-in-function.html

Thanks,
James


On Thu, May 29, 2014 at 10:41 PM, Ramya S <ra...@suntecgroup.com> wrote:


	Thanks alot...
	
	But im looking for REGEXP funtion that matches a column value with a particular pattern.
	
	 For eg:
	       WHERE (REGEXP_LIKE(patient_phone, '^\([[:digit:]]{3}\) [[:digit:]]{3}-[[:digit:]]{4}$')));
	
	Is that possible with phoenix?
	
	Ramya.S
	
	________________________________
	
	From: Andrew [mailto:al@starfishzone.com]
	Sent: Thu 5/29/2014 7:19 PM
	To: user@phoenix.incubator.apache.org
	Subject: Re: Pattern Matching using Phoenix
	


	Yes, please see:
	http://phoenix.incubator.apache.org/language/functions.html#regexp_substr
	
	On 29/05/2014 13:05, Ramya S wrote:
	
	
	
	        Hi,
	
	        Im using phoenix-2.2.2 on Apache hadoop-1.0.4.
	
	        Does phoenix support REGEXP operator or is there any equivalent operator for pattern matching using phoenix.
	
	
	        Please help to solve  the same.
	
	
	
	
	        Thanks & Regards
	
	        Ramya.S
	
	
	
	



Re: Pattern Matching using Phoenix

Posted by James Taylor <ja...@apache.org>.
Our functions are listed here:
http://phoenix.incubator.apache.org/language/functions.html#regexp_replace

We have LIKE, but not REGEXP_LIKE. Maybe you can contribute it - it's
pretty easy? There's a step by step guide here:
http://phoenix-hbase.blogspot.com/2013/04/how-to-add-your-own-built-in-function.html

Thanks,
James


On Thu, May 29, 2014 at 10:41 PM, Ramya S <ra...@suntecgroup.com> wrote:

> Thanks alot...
>
> But im looking for REGEXP funtion that matches a column value with a
> particular pattern.
>
>  For eg:
>        WHERE (REGEXP_LIKE(patient_phone, '^\([[:digit:]]{3}\)
> [[:digit:]]{3}-[[:digit:]]{4}$')));
>
> Is that possible with phoenix?
>
> Ramya.S
>
> ________________________________
>
> From: Andrew [mailto:al@starfishzone.com]
> Sent: Thu 5/29/2014 7:19 PM
> To: user@phoenix.incubator.apache.org
> Subject: Re: Pattern Matching using Phoenix
>
>
> Yes, please see:
> http://phoenix.incubator.apache.org/language/functions.html#regexp_substr
>
> On 29/05/2014 13:05, Ramya S wrote:
>
>
>
>         Hi,
>
>         Im using phoenix-2.2.2 on Apache hadoop-1.0.4.
>
>         Does phoenix support REGEXP operator or is there any equivalent
> operator for pattern matching using phoenix.
>
>
>         Please help to solve  the same.
>
>
>
>
>         Thanks & Regards
>
>         Ramya.S
>
>
>
>

RE: Pattern Matching using Phoenix

Posted by Ramya S <ra...@suntecgroup.com>.
Thanks alot...
 
But im looking for REGEXP funtion that matches a column value with a particular pattern.
 
 For eg:  
       WHERE (REGEXP_LIKE(patient_phone, '^\([[:digit:]]{3}\) [[:digit:]]{3}-[[:digit:]]{4}$')));
 
Is that possible with phoenix?
 
Ramya.S 

________________________________

From: Andrew [mailto:al@starfishzone.com]
Sent: Thu 5/29/2014 7:19 PM
To: user@phoenix.incubator.apache.org
Subject: Re: Pattern Matching using Phoenix


Yes, please see:
http://phoenix.incubator.apache.org/language/functions.html#regexp_substr

On 29/05/2014 13:05, Ramya S wrote:


	 
	Hi,
	 
	Im using phoenix-2.2.2 on Apache hadoop-1.0.4. 
	 
	Does phoenix support REGEXP operator or is there any equivalent operator for pattern matching using phoenix.
	 
	
	Please help to solve  the same.
	 
	 
	
	
	Thanks & Regards
	 
	Ramya.S 
	 



Re: Pattern Matching using Phoenix

Posted by Andrew <al...@starfishzone.com>.
Yes, please see:
http://phoenix.incubator.apache.org/language/functions.html#regexp_substr

On 29/05/2014 13:05, Ramya S wrote:
> Hi,
> Im using phoenix-2.2.2 on Apache hadoop-1.0.4.
> *Does phoenix support* *REGEXP operator or is there any equivalent 
> operator for pattern matching using phoenix.*
> Please help to solve  the same.
> /Thanks & Regards/
> *Ramya.S *