[
https://issues.apache.org/jira/browse/PHOENIX-2021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14581458#comment-14581458
]
ramkrishna.s.vasudevan commented on PHOENIX-2021:
-------------------------------------------------
This patch is bit complicated. I have gone thro the logic. Will give a walk
thro once more. Few comments and nits
-> Why is ArrayConcat also a subclass of ArrayModifierFunction? Can't we make
it like that? There are some common code in it still.
-> throw new DataExceedsCapacityException(""); - Some valid message is needed.
I think this applies to the existing ArrayModifierFunction also.
{code}
int nMultiplesOver255 = totalNulls / 255;
while (nMultiplesOver255-- > 0) {
newArray[currentPosition++] = 1;
}
int nRemainingNulls = totalNulls % 255;
if (nRemainingNulls > 0) {
byte nNullByte = SortOrder.invert((byte)(nRemainingNulls-1));
newArray[currentPosition++] = nNullByte;
}
{code}
this logic is now happening in more than one place. Unify this. The existing
array serialization also does it and the ArrayAppend/Prepend also needed that.
{code}
int totalNulls = nullsAtTheEndOfArray1 + nullsAtTheBeginningOfArray2;
{code}
Rename totalNulls to totalNullsinMiddleAfterconcat - because it is not the
actual totalNulls in the concatenated array.
The increase in length is always going to happen because of the nulls that are
accountable in the first part of the 2nd array combined with the nulls at the
end of the first array. Here for the nulls at the end of the first array is
just not going to do any increase or change to the length increase due to nulls.
So why do we do this
{code}
int lengthIncreaseForNulls = bytesForNullsAfter - bytesForNullsBefore;
{code}
The offset calc will take a look again in the next patch. Thanks for the great
work [~Dumindux].
> Implement ARRAY_CAT built in function
> -------------------------------------
>
> Key: PHOENIX-2021
> URL: https://issues.apache.org/jira/browse/PHOENIX-2021
> Project: Phoenix
> Issue Type: Sub-task
> Reporter: Dumindu Buddhika
> Assignee: Dumindu Buddhika
> Attachments: PHOENIX-2021.patch
>
>
> Ex:
> ARRAY_CAT(ARRAY[2, 3, 4], ARRAY[4, 5, 6]) = ARRAY[2,3,4,4,5,6]
> ARRAY_CAT(ARRAY["a", "b"], ARRAY["c", "d"]) = ARRAY["a", "b", "c", "d"]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)