phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dumindu Buddhika (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PHOENIX-1705) implement ARRAY_APPEND built in function
Date Tue, 10 Mar 2015 12:16:38 GMT

     [ https://issues.apache.org/jira/browse/PHOENIX-1705?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dumindu Buddhika updated PHOENIX-1705:
--------------------------------------
    Attachment: PHOENIX-1705_implement_ARRAY_APPEND_built_in_function.patch

Patch for ARRAY_APPEND.

Hi [~jamestaylor], I have written code to append elements to variable length arrays as well
and created some tests. Can you review the code :)? I have used coerceBytes method with castible
datatypes as you mentioned earlier.I have tested the code with varchar, int, double, bigint
arrays. Tests run properly for them.

However there is a problem I couldn't properly solve with fixed length char arrays. Since
in a Char array, every element has a previously defined fixed length,
ex 
{code}
CHAR(15)[]
{code}

When an element appended to this kind of an array, second argument(element to be appended)
comes as a varchar. So I need to convert this varchar to a byte array with a length of expression.getMaxLength()(in
above example it would be 15). I tried to use baseType.coerceBytes method with  expression.getMaxLength()
as desiredMaxLength. But it only gives a byte array with only the varchar(not of the expression.getMaxLength()).
I can create an array of expression.getMaxLength() and fill the extra bytes in the Char array
case. But I am not sure it is the best way to do it. Is there a way to achieve this?

I have done type checking in the constructor, it throws an IllegalArgumentException if type
validation fails. 

Testcase for the char arrays fails due to the problem I mentioned.


> implement ARRAY_APPEND built in function
> ----------------------------------------
>
>                 Key: PHOENIX-1705
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1705
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Dumindu Buddhika
>            Assignee: Dumindu Buddhika
>         Attachments: PHOENIX-1705_implement_ARRAY_APPEND_built_in_function.patch, PHOENIX-1705_implement_ARRAY_APPEND_built_in_function.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message