[ 
https://issues.apache.org/jira/browse/PHOENIX-1705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14352422#comment-14352422
 ] 

Dumindu Buddhika commented on PHOENIX-1705:
-------------------------------------------

[~jamestaylor], [~sergey.b] Thank you very much for the feedback.

Hi, I think ARRAY_APPEND should not handle the case where the appending element 
itself is an array. If you look at PostgreSQL array functions They have a 
separate function for concatenating two arrays called ARRAY_CAT,
http://www.postgresql.org/docs/9.2/static/functions-array.html

If we concatenate two arrays in the ARRAY_APPEND function it carries a wrong 
meaning,

For example if someone use the function in the following way,

{code:sql}
ARRAY_APPEND(array[1,2,3], array [4,5])
{code}

He is expecting a result like this,

{code:sql}
ARRAY[1,2,3,ARRAY[4,5]]
{code}

But since we do not support multi-dimensional arrays(to my knowledge) we 
shouldn't handle this case here.

I think a separate ARRAY_CAT built in function should be implemented for 
concatenation of arrays.

What do you think about that?

[~jamestaylor] I will remove the copying of bytes to a new array and improve 
the function to support variable length arrays. Thanks for the info on 
coerceBytes :). 
I am not very clear about the third point. So should we check types in the 
constructor of ArrayAppendFunction class? 

at here,
{code:java}
public ArrayAppendFunction(List<Expression> children) throws SQLException {
        super(children);
}
{code}

Thanks.

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




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

Reply via email to