[
https://issues.apache.org/jira/browse/PHOENIX-1875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14530190#comment-14530190
]
ramkrishna.s.vasudevan commented on PHOENIX-1875:
-------------------------------------------------
This look much better now, except one
{code}
public void testForNullsWith510NullsAtBeginning() throws Exception {
{code}
Did you try with 509 nulls?
{code}
int nMultiplesOver255 = nulls / 255;
589 int nRemainingNulls = nulls % 255;
590 lengthIncrease = nRemainingNulls == 1 ?
(nMultiplesOver255 == 0 ? 2*Bytes.SIZEOF_BYTE : Bytes.SIZEOF_BYTE):0;
{code}
Now the nRemainingMulls will be 2. So there will be an increase in the length
here correct? Your calculation will not allow the lengthIncrease because
nRemainingNulls will be 0.
The good thing about doing this is we are sure that on adding an element there
will be an increase in the length and that would be clear when we code like
this..
The below test case may not be needed
{code}
public void testForNullsWith610NullsAtBeginning() throws Exception {
{code}
My intention was to have a test case where the nMultiplesOver255 increases by
1. (and it won't increase more than that).
> 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
>
>
> 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)