Github user JamesRTaylor commented on a diff in the pull request:
https://github.com/apache/incubator-phoenix/pull/8#discussion_r10001651
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/schema/PArrayDataType.java ---
@@ -160,44 +236,85 @@ public static void
positionAtArrayElement(ImmutableBytesWritable ptr, int arrayI
// So inorder to know the length of the
4th element we will read the offset of 4th element and the offset of 5th
element.
// Subtracting the offset of 5th
element and 4th element will give the length of 4th element
// So we could just skip reading the
other elements.
+
if(useShort) {
// If the arrayIndex is already
the last element then read the last before one element and the last element
offset = indexOffset +
(Bytes.SIZEOF_SHORT * arrayIndex);
if (arrayIndex == (noOfElements
- 1)) {
currOff =
Bytes.toShort(bytes, offset, baseSize) + Short.MAX_VALUE;
+ ptr.set(bytes, currOff
+ initPos, 1);
+
if(ptr.compareTo(QueryConstants.SEPARATOR_BYTE_ARRAY) == 0) {
+ // null found
+ currOff+=2;
--- End diff --
Can you remind me what the currOff+=2 is for? Aren't you just doing this:
int currOffset = getOffsetFor(elemPosition);
int elemLength = bytes[currOffset] == SEPARATOR_BYTE ?
0 : getOffsetFor(elemPosition+1) - currOffset - 1; // Subtract one
to ignore separator byte
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---