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

Reply via email to