[
https://issues.apache.org/jira/browse/PHOENIX-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14012657#comment-14012657
]
ramkrishna.s.vasudevan commented on PHOENIX-1008:
-------------------------------------------------
The problem lies here PArrayDataType.coerceBytes
{code}
if (value == null && actualType != desiredType) {
value = toObject(ptr.get(), ptr.getOffset(), ptr.getLength(),
baseType, actualModifer, maxLength,
desiredScale, desiredBaseType);
PhoenixArray pArr = (PhoenixArray)value;
// VARCHAR <=> CHAR
if(baseType.isFixedWidth() != desiredBaseType.isFixedWidth()) {
pArr = new PhoenixArray(pArr, desiredMaxLength);
}
baseType = desiredBaseType;
ptr.set(toBytes(pArr, baseType, expectedModifier));
} else {
PhoenixArray pArr = (PhoenixArray)value;
pArr = new PhoenixArray(pArr, desiredMaxLength);
ptr.set(toBytes(pArr, baseType, expectedModifier));
}
{code}
The condition
{code}
if (value == null && actualType != desiredType) {
{code}
In this case the value is not null and so the desired conversion is not done.
> Problem initiating and using FLOAT ARRAY Type
> ---------------------------------------------
>
> Key: PHOENIX-1008
> URL: https://issues.apache.org/jira/browse/PHOENIX-1008
> Project: Phoenix
> Issue Type: Bug
> Environment: Phoenix 3.0 with Hbase 0.94.18
> uname -a: Linux faisal-VirtualBox 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10
> 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
> Reporter: Faisal Moeen
> Priority: Minor
>
> I am unable to use float arrays. I am facing no problem with varchar, integer
> or double arrays doing same. I create a table like this:
> {quote}
> create table if not exists location(name varchar not null, point float
> array[2], box float array[4], constraint pk primary key (name));
> {quote}
> I add a row to it:
> {quote}
> upsert into LOCATION values('qaisar', array[75.0,75.0],
> array[72.1,74.1,74.1,72.1]);
> {quote}
> Now I check array lengths:
> {quote}
> select array_length(point),array_length(box) from LOCATION;
> {quote}
> I get the following answer:
> {quote}
> 5,8
> {quote}
> whereas I expect
> {quote}
> 2,4
> {quote}
> The values point[1] or point[2] are also not correct.
--
This message was sent by Atlassian JIRA
(v6.2#6252)