[
https://issues.apache.org/jira/browse/PHOENIX-37?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13912379#comment-13912379
]
James Taylor commented on PHOENIX-37:
-------------------------------------
Couple of minor comments to simply things:
- simplify PArrayDataType.positionAtArrayElement method by replacing loop with
something like this (where you create a little helper function to get the
offset taking into account if the offsets are shorts versus longs):
{code}
int currOffset = getOffsetFor(elemPosition);
int elemLength = bytes[currOffset] == SEPARATOR_BYTE ?
0 : getOffsetFor(elemPosition+1) - currOffset - 1; // Subtract one to
ignore separator byte
{code}
See https://github.com/apache/incubator-phoenix/pull/8#discussion_r10005946
- change
{code}
if (!baseType.isFixedWidth() || baseType.isCoercibleTo(PDataType.VARCHAR)) {
{code}
to
{code}
if (!baseType.isFixedWidth()) {
{code}
See https://github.com/apache/incubator-phoenix/pull/8/files#r10064767
- refactor code to reduce duplication. See
https://github.com/apache/incubator-phoenix/pull/8/files#r10001394.
> 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)