You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by faisal moeen <fm...@gmail.com> on 2014/05/28 18:34:16 UTC

Problem with Phoenix Float Array Type?

Hi,

I am using Phoenix 3.0 with Hbase 0.94.18.
I am unable to use float arrays. I am facing no problem with varchar arrays
doing same.

I create a table like this:

*create table if not exists location(name varchar not null, point float
array[2], box float array[4], constraint pk primary key (name));*

I add a row to it:

*upsert into LOCATION values('qaisar', array[75.0,75.0],
array[72.1,74.1,74.1,72.1]);*

Now I check array lengths:

*select array_length(point),array_length(box) from LOCATION;*

I get the following answer:

*5,8*

whereas I expect

*2,4*

The values point[1] or point[2] are also not correct.
Am I doing something wrong?
An I upserting the data correctly?
Also if I user literal 75 instead of 75.0, it throws an exception.

Thanks.

-- 

Regards
Faisal Moeen

RE: Problem with Phoenix Float Array Type?

Posted by "Vasudevan, Ramkrishna S" <ra...@intel.com>.
Pls raise a bug, will look into it at the earliest.

Regards
Ram

From: James Taylor [mailto:jamestaylor@apache.org]
Sent: Thursday, May 29, 2014 2:47 AM
To: user@phoenix.incubator.apache.org
Subject: Re: Problem with Phoenix Float Array Type?

Faisal,
Thanks for reporting these issues with float arrays. These are definitely bugs. Please file JIRAs on them here: https://issues.apache.org/jira/browse/PHOENIX
Regards,
James

On Wed, May 28, 2014 at 11:25 AM, faisal moeen <fm...@gmail.com>> wrote:
Yes. integer arrays and double arrays are working fine.

Do I need to use some postfix with the literal values to specify that they are float?

In your example you used 'd' with the constants '2.0d'.

Regards
Faisal Moeen

On Wed, May 28, 2014 at 8:05 PM, Vasudevan, Ramkrishna S <ra...@intel.com>> wrote:
I tried this
create table TABLE_WITH_ARRAY (organization_id char(15) not null,entity_id char(15) not null,a_double_array double array[] CONSTRAINT pk PRIMARY KEY (organization_id, entity_id));

upsert into table_with_array values('" + tenantId"','00A123122312312',ARRAY[2.0d,345.8d])"

The below select queries worked fine too.
query = "SELECT ARRAY_ELEM(a_double_array,2) FROM table_with_array";
query  = "select array_length(a_double_array) from table_with_array";

Are you facing the problem with only Floats ?

Regards
Ram

From: faisal moeen [mailto:fmorakzai@gmail.com<ma...@gmail.com>]
Sent: Wednesday, May 28, 2014 10:04 PM
To: user@phoenix.incubator.apache.org<ma...@phoenix.incubator.apache.org>
Subject: Problem with Phoenix Float Array Type?

Hi,

I am using Phoenix 3.0 with Hbase 0.94.18.
I am unable to use float arrays. I am facing no problem with varchar arrays doing same.

I create a table like this:

create table if not exists location(name varchar not null, point float array[2], box float array[4], constraint pk primary key (name));

I add a row to it:

upsert into LOCATION values('qaisar', array[75.0,75.0], array[72.1,74.1,74.1,72.1]);

Now I check array lengths:

select array_length(point),array_length(box) from LOCATION;

I get the following answer:

5,8

whereas I expect

2,4

The values point[1] or point[2] are also not correct.
Am I doing something wrong?
An I upserting the data correctly?
Also if I user literal 75 instead of 75.0, it throws an exception.

Thanks.

--

Regards
Faisal Moeen



--

Regards
Faisal Moeen


Re: Problem with Phoenix Float Array Type?

Posted by James Taylor <ja...@apache.org>.
Faisal,
Thanks for reporting these issues with float arrays. These are definitely
bugs. Please file JIRAs on them here:
https://issues.apache.org/jira/browse/PHOENIX
Regards,
James


On Wed, May 28, 2014 at 11:25 AM, faisal moeen <fm...@gmail.com> wrote:

> Yes. integer arrays and double arrays are working fine.
>
> Do I need to use some postfix with the literal values to specify that they
> are float?
>
> In your example you used 'd' with the constants '2.0d'.
>
> Regards
> Faisal Moeen
>
>
> On Wed, May 28, 2014 at 8:05 PM, Vasudevan, Ramkrishna S <
> ramkrishna.s.vasudevan@intel.com> wrote:
>
>>  I tried this
>>
>> create table *TABLE_WITH_ARRAY* (organization_id char(15) not
>> null,entity_id char(15) not null,a_double_array double array[] CONSTRAINT
>> pk PRIMARY KEY (organization_id, entity_id));
>>
>>
>>
>> upsert into table_with_array values('" + tenantId
>> "','00A123122312312',ARRAY[2.0d,345.8d])"
>>
>>
>>
>> The below select queries worked fine too.
>>
>> query = "SELECT ARRAY_ELEM(a_double_array,2) FROM table_with_array";
>>
>> query  = "select array_length(a_double_array) from table_with_array";
>>
>>
>>
>> Are you facing the problem with only Floats ?
>>
>>
>>
>> Regards
>>
>> Ram
>>
>>
>>
>> *From:* faisal moeen [mailto:fmorakzai@gmail.com]
>> *Sent:* Wednesday, May 28, 2014 10:04 PM
>> *To:* user@phoenix.incubator.apache.org
>> *Subject:* Problem with Phoenix Float Array Type?
>>
>>
>>
>> Hi,
>>
>>
>>
>> I am using Phoenix 3.0 with Hbase 0.94.18.
>>
>> I am unable to use float arrays. I am facing no problem with varchar
>> arrays doing same.
>>
>>
>>
>> I create a table like this:
>>
>>
>>
>> *create table if not exists location(name varchar not null, point float
>> array[2], box float array[4], constraint pk primary key (name));*
>>
>>
>>
>> I add a row to it:
>>
>>
>>
>> *upsert into LOCATION values('qaisar', array[75.0,75.0],
>> array[72.1,74.1,74.1,72.1]);*
>>
>>
>>
>> Now I check array lengths:
>>
>>
>>
>> *select array_length(point),array_length(box) from LOCATION;*
>>
>>
>>
>> I get the following answer:
>>
>>
>>
>> *5,8*
>>
>>
>>
>> whereas I expect
>>
>>
>>
>> *2,4*
>>
>>
>>
>> The values point[1] or point[2] are also not correct.
>>
>> Am I doing something wrong?
>>
>> An I upserting the data correctly?
>>
>> Also if I user literal 75 instead of 75.0, it throws an exception.
>>
>>
>>
>> Thanks.
>>
>>
>>
>> --
>>
>>
>>
>> Regards
>>
>> Faisal Moeen
>>
>
>
>
> --
>
> Regards
> Faisal Moeen
>

Re: Problem with Phoenix Float Array Type?

Posted by faisal moeen <fm...@gmail.com>.
Yes. integer arrays and double arrays are working fine.

Do I need to use some postfix with the literal values to specify that they
are float?

In your example you used 'd' with the constants '2.0d'.

Regards
Faisal Moeen


On Wed, May 28, 2014 at 8:05 PM, Vasudevan, Ramkrishna S <
ramkrishna.s.vasudevan@intel.com> wrote:

>  I tried this
>
> create table *TABLE_WITH_ARRAY* (organization_id char(15) not
> null,entity_id char(15) not null,a_double_array double array[] CONSTRAINT
> pk PRIMARY KEY (organization_id, entity_id));
>
>
>
> upsert into table_with_array values('" + tenantId
> "','00A123122312312',ARRAY[2.0d,345.8d])"
>
>
>
> The below select queries worked fine too.
>
> query = "SELECT ARRAY_ELEM(a_double_array,2) FROM table_with_array";
>
> query  = "select array_length(a_double_array) from table_with_array";
>
>
>
> Are you facing the problem with only Floats ?
>
>
>
> Regards
>
> Ram
>
>
>
> *From:* faisal moeen [mailto:fmorakzai@gmail.com]
> *Sent:* Wednesday, May 28, 2014 10:04 PM
> *To:* user@phoenix.incubator.apache.org
> *Subject:* Problem with Phoenix Float Array Type?
>
>
>
> Hi,
>
>
>
> I am using Phoenix 3.0 with Hbase 0.94.18.
>
> I am unable to use float arrays. I am facing no problem with varchar
> arrays doing same.
>
>
>
> I create a table like this:
>
>
>
> *create table if not exists location(name varchar not null, point float
> array[2], box float array[4], constraint pk primary key (name));*
>
>
>
> I add a row to it:
>
>
>
> *upsert into LOCATION values('qaisar', array[75.0,75.0],
> array[72.1,74.1,74.1,72.1]);*
>
>
>
> Now I check array lengths:
>
>
>
> *select array_length(point),array_length(box) from LOCATION;*
>
>
>
> I get the following answer:
>
>
>
> *5,8*
>
>
>
> whereas I expect
>
>
>
> *2,4*
>
>
>
> The values point[1] or point[2] are also not correct.
>
> Am I doing something wrong?
>
> An I upserting the data correctly?
>
> Also if I user literal 75 instead of 75.0, it throws an exception.
>
>
>
> Thanks.
>
>
>
> --
>
>
>
> Regards
>
> Faisal Moeen
>



-- 

Regards
Faisal Moeen

RE: Problem with Phoenix Float Array Type?

Posted by "Vasudevan, Ramkrishna S" <ra...@intel.com>.
I tried this
create table TABLE_WITH_ARRAY (organization_id char(15) not null,entity_id char(15) not null,a_double_array double array[] CONSTRAINT pk PRIMARY KEY (organization_id, entity_id));

upsert into table_with_array values('" + tenantId"','00A123122312312',ARRAY[2.0d,345.8d])"

The below select queries worked fine too.
query = "SELECT ARRAY_ELEM(a_double_array,2) FROM table_with_array";
query  = "select array_length(a_double_array) from table_with_array";

Are you facing the problem with only Floats ?

Regards
Ram

From: faisal moeen [mailto:fmorakzai@gmail.com]
Sent: Wednesday, May 28, 2014 10:04 PM
To: user@phoenix.incubator.apache.org
Subject: Problem with Phoenix Float Array Type?

Hi,

I am using Phoenix 3.0 with Hbase 0.94.18.
I am unable to use float arrays. I am facing no problem with varchar arrays doing same.

I create a table like this:

create table if not exists location(name varchar not null, point float array[2], box float array[4], constraint pk primary key (name));

I add a row to it:

upsert into LOCATION values('qaisar', array[75.0,75.0], array[72.1,74.1,74.1,72.1]);

Now I check array lengths:

select array_length(point),array_length(box) from LOCATION;

I get the following answer:

5,8

whereas I expect

2,4

The values point[1] or point[2] are also not correct.
Am I doing something wrong?
An I upserting the data correctly?
Also if I user literal 75 instead of 75.0, it throws an exception.

Thanks.

--

Regards
Faisal Moeen