phoenix-dev mailing list archives

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


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


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,

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:
>             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

View raw message