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

ramkrishna.s.vasudevan commented on PHOENIX-1875:
-------------------------------------------------

Looks good to me.  
A big fat comment would be needed here to know what we are doing.  
{code}
                lengthIncrease = nRemainingNulls == 1 ? (nMultiplesOver255 == 0 
? 2 * Bytes.SIZEOF_BYTE : Bytes.SIZEOF_BYTE) : 0;
{code}
Will there be a case of nRemainingNulls does not change but nMultipliesOVer255 
changes? I don't think it would be possible. 
One important question, when I was trying to debug for NULLs in upsert i found 
that when we UPSERT null into a float array we return the result as 0.0, for eg,
{code}
("CREATE TABLE t ( k VARCHAR PRIMARY KEY, a Float ARRAY[])");
......
 stmt = conn.prepareStatement("UPSERT INTO t VALUES('a',ARRAY[2.0,null])");
{code}
The returning array is 2.0, 0.0.  Which means we are allowing nulls.

Now when we prepend/append a null I think we just don't add any new element for 
the primitive case.  Is that behaviour in sync with postgre?  
[~giacomotaylor]
Your thoughts on this?

> implement ARRAY_PREPEND built in function
> -----------------------------------------
>
>                 Key: PHOENIX-1875
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1875
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Dumindu Buddhika
>            Assignee: Dumindu Buddhika
>         Attachments: PHOENIX-1875-v2.patch, PHOENIX-1875-v3.patch, 
> PHOENIX-1875-v4.patch
>
>
> ARRAY_PREPEND(1, ARRAY[2, 3]) = ARRAY[1, 2, 3]
> ARRAY_PREPEND("a", ARRAY["b", "c"]) = ARRAY["a", "b", "c"]
> ARRAY_PREPEND(null, ARRAY["b", "c"]) = ARRAY[null, "b", "c"]



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

Reply via email to