phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pedro Boado <pedro.bo...@gmail.com>
Subject Re: Error using VARBINARY in Index
Date Mon, 13 May 2019 22:09:45 GMT
Hi,

Indexes in Phoenix are implemented using an additional HBase table, and the
index key fields are serialized as HBase table key.

So same limitations apply to varbinary and varchar when used as index
columns: they can only be used as the last column in the index key.

Cheers,
Pedro.

On Mon, 13 May 2019, 22:19 Nick Dimiduk, <ndimiduk@gmail.com> wrote:

> Hello,
>
> I'm experimenting with a new data model using secondary indices and
> stumbled into a surprise. My understanding is that arrays and VARBINARY are
> permitted in rowkeys so long as they are the trailing rowkey member. Why is
> this schema definition is not permitted?
>
> CREATE TABLE IF NOT EXISTS t
> (
>   a VARCHAR NOT NULL,
>   b VARBINARY
>   CONSTRAINT pk PRIMARY KEY (a)
> );
> CREATE INDEX IF NOT EXISTS t_index ON t(b) INCLUDE (a);
>
> > Error: ERROR 1005 (42J03): The VARBINARY/ARRAY type can only be used as
> the last part of a multi-part row key. columnName=T_INDEX.0:B
> (state=42J03,code=1005)
>
> I get the same error when adding an additional, non-null column to the
> index definition.
>
> CREATE TABLE IF NOT EXISTS t
> (
>   a VARCHAR NOT NULL,
>   b VARCHAR NOT NULL,
>   c VARBINARY
>   CONSTRAINT pk PRIMARY KEY (a, b)
> )
> ;
> CREATE INDEX IF NOT EXISTS t_index ON t(b, c) INCLUDE (a);
>
> > Error: ERROR 1005 (42J03): The VARBINARY/ARRAY type can only be used as
> the last part of a multi-part row key. columnName=T_INDEX.0:C
> (state=42J03,code=1005)
>
> This is apache-phoenix-4.14.1-HBase-1.4.
>
> Thanks,
> Nick
>

Mime
View raw message