[
https://issues.apache.org/jira/browse/PHOENIX-37?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13912606#comment-13912606
]
ramkrishna.s.vasudevan commented on PHOENIX-37:
-----------------------------------------------
{code}
String[] strArr = new String[5];
strArr[0] = null;
strArr[1] = "ereref";
strArr[2] = "random";
strArr[3] = null;
strArr[4] = "ran";
{code}
Take this case. Now if i want to retrieve element [4] i.e. ran, now the offset
would be
{code}
[0, 0, 9, 16, 16]
{code}
So now trying to retrive the last element would mean that my offset is going to
have an elementlength as 0, but that is not what we want. Hence we should skip
this element and read the next bytes till the index offset (i mean the next
element) to get the actual lenght. Hence in my current logic i have
incremented the currOffset by 2 for such cases. I have tried different options
to form the offset, but since we are collecting the number of nulls (for non
traling nulls) some where we have to adjust our offsets.
> Prevent deserialize and re-serialize all array elements in construction of
> array
> --------------------------------------------------------------------------------
>
> Key: PHOENIX-37
> URL: https://issues.apache.org/jira/browse/PHOENIX-37
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 3.0.0
> Reporter: James Taylor
> Assignee: ramkrishna.s.vasudevan
> Fix For: 3.0.0
>
> Attachments: Phoenix-37_final.patch
>
>
> ArrayConstructorExpression.evaluate() currently deserializes into object form
> all array elements only to serialize them back again as bytes. Instead, just
> use a TrustedByteArrayOuputStream (initially sized based on the number of
> child elements) to serialize the data into. If variable length, track the
> offset information as the data is written.
> Second, we should put the header information (offsets, length, and version)
> at the end of the array instead of the start. This will make it possible to
> compare arrays against each other in their byte form.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)