[ 
https://issues.apache.org/jira/browse/PHOENIX-777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14543365#comment-14543365
 ] 

Dumindu Buddhika commented on PHOENIX-777:
------------------------------------------

New fixedwidth array serialization format as discussed with [~ram_krish]

[ElementBytes] [BitSet for tracking nulls] [BitSet offset] [separator byte] 
[serialization version number].

Since there is no serialization version number at the end of array in current 
serialization format, last two bytes(separator byte and version number) are 
checked to identify serialization version at the deserialization process to 
preserve backward compatibility.

In case of primitive type arrays, at convertObjectArrayToPrimitiveArray
{code}
        @Override
        public Object convertObjectArrayToPrimitiveArray(Object[] elements) {
            intArr = new int[elements.length];
            int i = 0;
            for (Object o : elements) {
                if (o != null) {
                    intArr[i] = (Integer) o;
                }
                i++;
            }
            return intArr;
        }
{code}
As null elements are considered as 0's nulls do not stay as nulls. So there is 
an issue.

> Support null value for fixed length ARRAY
> -----------------------------------------
>
>                 Key: PHOENIX-777
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-777
>             Project: Phoenix
>          Issue Type: Task
>            Reporter: James Taylor
>            Assignee: Dumindu Buddhika
>
> A null value for a fixed length array can be handled with a bitset tacked on 
> the end of the array. If an element is set to null, then the bit at that 
> index is set. Trailing nulls are not stored and an attempt to access an array 
> past the current size returns null.
> Current behavior,
> PBinaryArray - Throws an exception when a null is inserted.
> PBooleanArray - null is considered as false when a null is inserted.
> PCharArray - Throws an exception when a null is inserted.
> PDateArray - Throws an exception when a null is inserted.
> PDoubleArray - null is considered as 0.0 when a null is inserted.
> PFloatArray - null is considered as 0.0 when a null is inserted.
> PIntegerArray - null is considered as 0 when a null is inserted.
> PLongArray - null is considered as 0 when a null is inserted.
> PSmallIntArray - null is considered as 0 when a null is inserted.
> PTimeArray - Throws an exception when a null is inserted.
> PTimeStampArray - Throws an exception when a null is inserted.
> PTinyIntArray - null is considered as 0 when a null is inserted.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to