You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by anil gupta <an...@gmail.com> on 2014/07/09 20:38:53 UTC

TO_UNSIGNED_DATE function missing in Phoenix

Hi All,

Phoenix has a DataType Unsigned_Date but now i am unable to use these
columns for filtering. For using a date column in sql query i can use
to_date(). I think similarly we need to have to_unsigned_date function. I
can file a jira for this. Can anyone guide me how to introduce this
function in sql language of Phoenix.

-- 
Thanks & Regards,
Anil Gupta

Re: TO_UNSIGNED_DATE function missing in Phoenix

Posted by anil gupta <an...@gmail.com>.
Ok, Sqlline confused me! It seems like there is a time component i the data
value but the sqlline is not showing me.

This query works:
select * from events where dummy_date>TO_DATE('2012-12-20', 'yyyy-MM-dd')
and dummy_date<TO_DATE('2012-12-21', 'yyyy-MM-dd') and id='1234' limit 50;

Thanks for your help.

~Anil


On Wed, Jul 9, 2014 at 12:19 PM, anil gupta <an...@gmail.com> wrote:

> Hi James,
>
> I am using Phoenix3.0 along with HBase0.94.15. Do you mean to say that
> this query should work even if dummy_date is unsigned_date?
> select * from events where dummy_date=TO_DATE('2012-12-23', 'yyyy-MM-dd')
> and id='1234' limit 50;
>
> I tried this query and i didn't get correct results. I have data in the
> table where dummy_date = 2012-12-23.
>
> ~Anil
>
>
>
> On Wed, Jul 9, 2014 at 12:13 PM, James Taylor <ja...@apache.org>
> wrote:
>
>> Not sure, as it looks correct. What version of Phoenix are you using?
>> FWIW,
>> that query should work w/out the cast too.
>>
>> Thanks,
>> James
>>
>> On Wednesday, July 9, 2014, anil gupta <an...@gmail.com> wrote:
>>
>> > Hi James,
>> > I tried following query:
>> > select * from events where dummy_date=CAST(TO_DATE('2012-12-23',
>> > 'yyyy-MM-dd') AS UNSIGNED_DATE) and id='1234' limit 50;
>> >
>> > But, i get following error:
>> > Error: ERROR 602 (42P00): Syntax error. Missing "LPAREN" at line 1,
>> column
>> > 30. (state=42P00,code=602)
>> >
>> > Can you tell me whats wrong here?
>> >
>> > Thanks,
>> > Anil Gupta
>> >
>> >
>> > On Wed, Jul 9, 2014 at 11:48 AM, James Taylor <jamestaylor@apache.org
>> > <javascript:;>>
>> > wrote:
>> >
>> > > Hi Anil,
>> > >
>> > > Try using CAST to explicitly cast the result to an unsigned date, like
>> > > this: CAST(TO_DATE(someDate) AS UNSIGNED_DATE)
>> > >
>> > > Thanks,
>> > > James
>> > >
>> > > On Wed, Jul 9, 2014 at 8:38 PM, anil gupta <anilgupta84@gmail.com
>> > <javascript:;>> wrote:
>> > > > Hi All,
>> > > >
>> > > > Phoenix has a DataType Unsigned_Date but now i am unable to use
>> these
>> > > > columns for filtering. For using a date column in sql query i can
>> use
>> > > > to_date(). I think similarly we need to have to_unsigned_date
>> > function. I
>> > > > can file a jira for this. Can anyone guide me how to introduce this
>> > > > function in sql language of Phoenix.
>> > > >
>> > > > --
>> > > > Thanks & Regards,
>> > > > Anil Gupta
>> > >
>> >
>> >
>> >
>> > --
>> > Thanks & Regards,
>> > Anil Gupta
>> >
>>
>
>
>
> --
> Thanks & Regards,
> Anil Gupta
>



-- 
Thanks & Regards,
Anil Gupta

Re: TO_UNSIGNED_DATE function missing in Phoenix

Posted by James Taylor <ja...@apache.org>.
Yes, that should work. Look like bugs to me.

On Wednesday, July 9, 2014, anil gupta <an...@gmail.com> wrote:

> Hi James,
>
> I am using Phoenix3.0 along with HBase0.94.15. Do you mean to say that this
> query should work even if dummy_date is unsigned_date?
> select * from events where dummy_date=TO_DATE('2012-12-23', 'yyyy-MM-dd')
> and id='1234' limit 50;
>
> I tried this query and i didn't get correct results. I have data in the
> table where dummy_date = 2012-12-23.
>
> ~Anil
>
>
>
> On Wed, Jul 9, 2014 at 12:13 PM, James Taylor <jamestaylor@apache.org
> <javascript:;>>
> wrote:
>
> > Not sure, as it looks correct. What version of Phoenix are you using?
> FWIW,
> > that query should work w/out the cast too.
> >
> > Thanks,
> > James
> >
> > On Wednesday, July 9, 2014, anil gupta <anilgupta84@gmail.com
> <javascript:;>> wrote:
> >
> > > Hi James,
> > > I tried following query:
> > > select * from events where dummy_date=CAST(TO_DATE('2012-12-23',
> > > 'yyyy-MM-dd') AS UNSIGNED_DATE) and id='1234' limit 50;
> > >
> > > But, i get following error:
> > > Error: ERROR 602 (42P00): Syntax error. Missing "LPAREN" at line 1,
> > column
> > > 30. (state=42P00,code=602)
> > >
> > > Can you tell me whats wrong here?
> > >
> > > Thanks,
> > > Anil Gupta
> > >
> > >
> > > On Wed, Jul 9, 2014 at 11:48 AM, James Taylor <jamestaylor@apache.org
> <javascript:;>
> > > <javascript:;>>
> > > wrote:
> > >
> > > > Hi Anil,
> > > >
> > > > Try using CAST to explicitly cast the result to an unsigned date,
> like
> > > > this: CAST(TO_DATE(someDate) AS UNSIGNED_DATE)
> > > >
> > > > Thanks,
> > > > James
> > > >
> > > > On Wed, Jul 9, 2014 at 8:38 PM, anil gupta <anilgupta84@gmail.com
> <javascript:;>
> > > <javascript:;>> wrote:
> > > > > Hi All,
> > > > >
> > > > > Phoenix has a DataType Unsigned_Date but now i am unable to use
> these
> > > > > columns for filtering. For using a date column in sql query i can
> use
> > > > > to_date(). I think similarly we need to have to_unsigned_date
> > > function. I
> > > > > can file a jira for this. Can anyone guide me how to introduce this
> > > > > function in sql language of Phoenix.
> > > > >
> > > > > --
> > > > > Thanks & Regards,
> > > > > Anil Gupta
> > > >
> > >
> > >
> > >
> > > --
> > > Thanks & Regards,
> > > Anil Gupta
> > >
> >
>
>
>
> --
> Thanks & Regards,
> Anil Gupta
>

Re: TO_UNSIGNED_DATE function missing in Phoenix

Posted by anil gupta <an...@gmail.com>.
Hi James,

I am using Phoenix3.0 along with HBase0.94.15. Do you mean to say that this
query should work even if dummy_date is unsigned_date?
select * from events where dummy_date=TO_DATE('2012-12-23', 'yyyy-MM-dd')
and id='1234' limit 50;

I tried this query and i didn't get correct results. I have data in the
table where dummy_date = 2012-12-23.

~Anil



On Wed, Jul 9, 2014 at 12:13 PM, James Taylor <ja...@apache.org>
wrote:

> Not sure, as it looks correct. What version of Phoenix are you using? FWIW,
> that query should work w/out the cast too.
>
> Thanks,
> James
>
> On Wednesday, July 9, 2014, anil gupta <an...@gmail.com> wrote:
>
> > Hi James,
> > I tried following query:
> > select * from events where dummy_date=CAST(TO_DATE('2012-12-23',
> > 'yyyy-MM-dd') AS UNSIGNED_DATE) and id='1234' limit 50;
> >
> > But, i get following error:
> > Error: ERROR 602 (42P00): Syntax error. Missing "LPAREN" at line 1,
> column
> > 30. (state=42P00,code=602)
> >
> > Can you tell me whats wrong here?
> >
> > Thanks,
> > Anil Gupta
> >
> >
> > On Wed, Jul 9, 2014 at 11:48 AM, James Taylor <jamestaylor@apache.org
> > <javascript:;>>
> > wrote:
> >
> > > Hi Anil,
> > >
> > > Try using CAST to explicitly cast the result to an unsigned date, like
> > > this: CAST(TO_DATE(someDate) AS UNSIGNED_DATE)
> > >
> > > Thanks,
> > > James
> > >
> > > On Wed, Jul 9, 2014 at 8:38 PM, anil gupta <anilgupta84@gmail.com
> > <javascript:;>> wrote:
> > > > Hi All,
> > > >
> > > > Phoenix has a DataType Unsigned_Date but now i am unable to use these
> > > > columns for filtering. For using a date column in sql query i can use
> > > > to_date(). I think similarly we need to have to_unsigned_date
> > function. I
> > > > can file a jira for this. Can anyone guide me how to introduce this
> > > > function in sql language of Phoenix.
> > > >
> > > > --
> > > > Thanks & Regards,
> > > > Anil Gupta
> > >
> >
> >
> >
> > --
> > Thanks & Regards,
> > Anil Gupta
> >
>



-- 
Thanks & Regards,
Anil Gupta

Re: TO_UNSIGNED_DATE function missing in Phoenix

Posted by James Taylor <ja...@apache.org>.
Not sure, as it looks correct. What version of Phoenix are you using? FWIW,
that query should work w/out the cast too.

Thanks,
James

On Wednesday, July 9, 2014, anil gupta <an...@gmail.com> wrote:

> Hi James,
> I tried following query:
> select * from events where dummy_date=CAST(TO_DATE('2012-12-23',
> 'yyyy-MM-dd') AS UNSIGNED_DATE) and id='1234' limit 50;
>
> But, i get following error:
> Error: ERROR 602 (42P00): Syntax error. Missing "LPAREN" at line 1, column
> 30. (state=42P00,code=602)
>
> Can you tell me whats wrong here?
>
> Thanks,
> Anil Gupta
>
>
> On Wed, Jul 9, 2014 at 11:48 AM, James Taylor <jamestaylor@apache.org
> <javascript:;>>
> wrote:
>
> > Hi Anil,
> >
> > Try using CAST to explicitly cast the result to an unsigned date, like
> > this: CAST(TO_DATE(someDate) AS UNSIGNED_DATE)
> >
> > Thanks,
> > James
> >
> > On Wed, Jul 9, 2014 at 8:38 PM, anil gupta <anilgupta84@gmail.com
> <javascript:;>> wrote:
> > > Hi All,
> > >
> > > Phoenix has a DataType Unsigned_Date but now i am unable to use these
> > > columns for filtering. For using a date column in sql query i can use
> > > to_date(). I think similarly we need to have to_unsigned_date
> function. I
> > > can file a jira for this. Can anyone guide me how to introduce this
> > > function in sql language of Phoenix.
> > >
> > > --
> > > Thanks & Regards,
> > > Anil Gupta
> >
>
>
>
> --
> Thanks & Regards,
> Anil Gupta
>

Re: TO_UNSIGNED_DATE function missing in Phoenix

Posted by anil gupta <an...@gmail.com>.
Hi James,
I tried following query:
select * from events where dummy_date=CAST(TO_DATE('2012-12-23',
'yyyy-MM-dd') AS UNSIGNED_DATE) and id='1234' limit 50;

But, i get following error:
Error: ERROR 602 (42P00): Syntax error. Missing "LPAREN" at line 1, column
30. (state=42P00,code=602)

Can you tell me whats wrong here?

Thanks,
Anil Gupta


On Wed, Jul 9, 2014 at 11:48 AM, James Taylor <ja...@apache.org>
wrote:

> Hi Anil,
>
> Try using CAST to explicitly cast the result to an unsigned date, like
> this: CAST(TO_DATE(someDate) AS UNSIGNED_DATE)
>
> Thanks,
> James
>
> On Wed, Jul 9, 2014 at 8:38 PM, anil gupta <an...@gmail.com> wrote:
> > Hi All,
> >
> > Phoenix has a DataType Unsigned_Date but now i am unable to use these
> > columns for filtering. For using a date column in sql query i can use
> > to_date(). I think similarly we need to have to_unsigned_date function. I
> > can file a jira for this. Can anyone guide me how to introduce this
> > function in sql language of Phoenix.
> >
> > --
> > Thanks & Regards,
> > Anil Gupta
>



-- 
Thanks & Regards,
Anil Gupta

Re: TO_UNSIGNED_DATE function missing in Phoenix

Posted by James Taylor <ja...@apache.org>.
Hi Anil,

Try using CAST to explicitly cast the result to an unsigned date, like
this: CAST(TO_DATE(someDate) AS UNSIGNED_DATE)

Thanks,
James

On Wed, Jul 9, 2014 at 8:38 PM, anil gupta <an...@gmail.com> wrote:
> Hi All,
>
> Phoenix has a DataType Unsigned_Date but now i am unable to use these
> columns for filtering. For using a date column in sql query i can use
> to_date(). I think similarly we need to have to_unsigned_date function. I
> can file a jira for this. Can anyone guide me how to introduce this
> function in sql language of Phoenix.
>
> --
> Thanks & Regards,
> Anil Gupta