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

Alex Warshavsky commented on PHOENIX-1872:
------------------------------------------

[~jamestaylor] BooleanCodec doesn't exist. This is bigger than initially 
thought. This is not just a matter of adding a factory, this also includes 
creating a codec for Boolean. It's unclear if boolean fits within the logic of 
current PDataCodec interface which encodes/decodes only numeric types 
currently, see below. How does boolean convert to long or vice versa?

I've seen logic in the boolean that says PDecimal ZERO_BYTE converts to 
BOOLEAN.FALSE and other values convert to BOOLEAN.TRUE. Is that how it should 
work?

    public long decodeLong(byte[] b, int o, SortOrder sortOrder);
    public int decodeInt(ImmutableBytesWritable ptr, SortOrder sortOrder);
    public int decodeInt(byte[] b, int o, SortOrder sortOrder);
    public byte decodeByte(byte[] b, int o, SortOrder sortOrder);
    public short decodeShort(byte[] b, int o, SortOrder sortOrder);
    public float decodeFloat(byte[] b, int o, SortOrder sortOrder);
    public double decodeDouble(byte[] b, int o, SortOrder sortOrder);
    public int encodeLong(long v, byte[] b, int o);
    public int encodeInt(int v, byte[] b, int o);
    public int encodeByte(byte v, byte[] b, int o);
    public int encodeShort(short v, byte[] b, int o);
    public int encodeFloat(float v, byte[] b, int o);
    public int encodeDouble(double v, byte[] b, int o);


> Support PrimitiveBooleanPhoenixArray when creating PhoenixArray from Boolean[]
> ------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1872
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1872
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Alex Warshavsky
>            Assignee: Alex Warshavsky
>            Priority: Minor
>              Labels: newbie
>
> Currently, when phoenix array is created from a boolean array, PhoenixArray 
> in instantiated instead of PrimitiveBooleanPhoenixArray.
> PArrayDataType.instantiatePhoenixArray(type, Boolean[] \{true, false});
> Other scalar/primitive types implement PhoenixArrayFactory to take advantage 
> of primitive arrays. E.g. 
> PArrayDataType.instantiatePhoenixArray(type, Integer[] \{1,2});
> returns PrimitiveIntPhoenixArray.



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

Reply via email to