Repository: phoenix Updated Branches: refs/heads/4.x-cdh5.11.2 e9dc8ad9b -> bd554b437
HOENIX-4382 Immutable table SINGLE_CELL_ARRAY_WITH_OFFSETS values starting with separator byte return null in query results (amendment adding comments) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/bd554b43 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bd554b43 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bd554b43 Branch: refs/heads/4.x-cdh5.11.2 Commit: bd554b4374ba5bf875f16051c3d2bfc1005a9e4b Parents: e9dc8ad Author: Vincent Poon <[email protected]> Authored: Wed Dec 27 15:49:57 2017 -0800 Committer: Vincent Poon <[email protected]> Committed: Wed Dec 27 15:49:57 2017 -0800 ---------------------------------------------------------------------- .../org/apache/phoenix/schema/types/PArrayDataTypeDecoder.java | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/bd554b43/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataTypeDecoder.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataTypeDecoder.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataTypeDecoder.java index c303db1..22fa46c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataTypeDecoder.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataTypeDecoder.java @@ -132,6 +132,7 @@ public class PArrayDataTypeDecoder implements ColumnValueDecoder { return true; } + // returns true if the prior element in the array is a null private static boolean isNullValue(int arrayIndex, byte[] bytes, int initPos, byte serializationVersion, boolean useShort, int indexOffset, int currOffset, int elementLength) { @@ -142,6 +143,8 @@ public class PArrayDataTypeDecoder implements ColumnValueDecoder { } else { // if there's no prior null, there can be at most 1 null if (elementLength == 2) { + // nullByte calculation comes from the encoding of one null + // see PArrayDataType#serializeNulls byte nullByte = SortOrder.invert((byte)(0)); if (bytes[initPos+currOffset+1] == nullByte) { return true; @@ -152,6 +155,7 @@ public class PArrayDataTypeDecoder implements ColumnValueDecoder { return false; } + // checks prior value length by subtracting offset of the previous item from the current offset private static boolean isPriorValueZeroLength(int arrayIndex, byte[] bytes, byte serializationVersion, boolean useShort, int indexOffset, int currOffset) { return arrayIndex > 0 && currOffset - PArrayDataType.getOffset(bytes, arrayIndex - 1,
