[
https://issues.apache.org/jira/browse/PHOENIX-123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13926410#comment-13926410
]
James Taylor commented on PHOENIX-123:
--------------------------------------
The call to coerceBytes exits early if maxLength == desiredMaxLength. Would
these be different in these two different code paths? Are there other options,
as we need to set ptr to the bytes.
Regarding not setting the header/footer for fixed width arrays, it's because 1)
we don't need to serialized the number of elements as we can always calculate
it, and 2) it would mess up comparisons of two fixed width arrays, as the
footer bytes would be used in the comparison, once you run out of data bytes
against the longer one. Then if an element in the longer one happened to have a
byte value less than the number of elements in the shorter one, the sort order
would be wrong.
> Fixed with array should not write any footer
> --------------------------------------------
>
> Key: PHOENIX-123
> URL: https://issues.apache.org/jira/browse/PHOENIX-123
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 3.0.0
> Reporter: James Taylor
> Fix For: 3.0.0
>
> Attachments: Phoenix-123.patch, arrayLength.patch
>
>
> Fixed length arrays should not write any footer, as it might throw off the
> byte comparison. For example, if comparing two arrays of different lengths,
> the longer array would begin to compare its elements against the footer of
> the shorter array. If the footer happened to be bigger (bytes-wise) for the
> shorter array, it would incorrectly evaluate to being bigger.
--
This message was sent by Atlassian JIRA
(v6.2#6252)