Yes, a BIGINT (fixed 8 byte Long) may be used in an index. Pretty much every fixed sized type *except* BINARY may be used. Because a column value that maps to a KeyValue may be null (i.e. absent), we need a way of representing that in the index row key. With numeric types we have that by converting them to a DECIMAL.

File a JIRA, though. There are ways to encode BINARY data that would leave us a way to represent the absence of a value.

On Sun, Mar 30, 2014 at 9:21 PM, Dan Di Spaltro <> wrote:
Yeah I guess I was just assuming like a Long (fixed 8 bytes) it could be treated the same.  Actually that reminds me, can you use a long to index?  Does it internally maintain the 8 byte binary array?

On Fri, Mar 28, 2014 at 10:23 AM, James Taylor <> wrote:
One option would be to base64 encode your fixed length binary as a String. Then store it that way in Phoenix and you'd be able to index it.

It's possible that we could encode binary data in a way that would let us index it - how about filing a JIRA for that?


On Fri, Mar 28, 2014 at 3:09 AM, Dan Di Spaltro <> wrote:
So James' ticket seems to indicate this is intended behavior, have you resolved that?  It seems like an index on arbitrarily fixed-with bytes aren't a bad thing.

On Wed, Mar 26, 2014 at 3:49 PM, Samarth Jain <> wrote:
Hi Dan,

Thanks for reporting. 

I am working on a fix for this. Please see:


On Wed, Mar 26, 2014 at 3:42 PM, Dan Di Spaltro <> wrote:
I have a table with two indexes

create table auth.account_users 
    ordered_id BINARY(16) not null PRIMARY KEY, 
    account_id BINARY(16) not null, 
    user_id BINARY(16) not null, 
    default BOOLEAN, 
    created_at TIMESTAMP 

CREATE INDEX auth_account_users_user_idx ON auth.account_users(user_id) 

CREATE INDEX auth_account_users_account_idx ON auth.account_users(account_id)

The creation works fine on this but during insert I get the following message, I am wondering is this intended?  Judging by the code it should work... I am using the 4.0 RC btw.

java.lang.IllegalArgumentException: Unsupported non nullable index type BINARY
at org.apache.phoenix.util.IndexUtil.getIndexColumnDataType(
at org.apache.phoenix.index.IndexMaintainer.buildRowKey(
at org.apache.phoenix.index.IndexMaintainer.buildUpdateMutation(
at org.apache.phoenix.util.IndexUtil.generateIndexData(
at org.apache.phoenix.execute.MutationState$
at org.apache.phoenix.execute.MutationState$
at org.apache.phoenix.execute.MutationState.commit(
at org.apache.phoenix.jdbc.PhoenixConnection.commit(
at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(
at org.apache.phoenix.jdbc.PhoenixStatement.execute(
at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(
at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(

Dan Di Spaltro

Dan Di Spaltro

Dan Di Spaltro