Hi JM,
Yes, that's possible - it's more-or-less what a secondary index is. So
you'd define your table as you did in your first CREATE TABLE
statement, and then you'd define a secondary index like this:
CREATE INDEX S_W_IDX ON "asset_metadata" (W);
You could also include other columns in the index to make it a covered index:
CREATE INDEX S_W_IDX ON "asset_metadata" (W)
INCLUDE (P, N, E, S, M, T);
where you'd add the columns you'd likely also use when you filter on
s.W in a WHERE clause. Depending on your use case, you might choose
immutable/mutable and local/global - take a look here for more info:
http://phoenix.apache.org/secondary_indexing.html
Thanks,
James
On Mon, Sep 29, 2014 at 6:15 AM, Jean-Marc Spaggiari
<[email protected]> wrote:
> Hi,
>
> Can I have a column qualifier part of a key?
>
> Doing this I define columns based on the RowKey:
>
> create view "asset_metadata" (
>
> L unsigned_long not null,
>
> A unsigned_long not null,
>
> R bigint not null,
>
> "s".W unsigned_long,
>
> "s".P bigint,
>
> "s".N varchar,
>
> "s".E varchar,
>
> "s".S unsigned_long,
>
> "s".M unsigned_long,
>
> "s".T unsigned_int,
>
> CONSTRAINT pk primary key (L,A,R)
>
> );
>
> But I would like to also have one key field as a CQ.
>
> something like:
>
> create view "asset_metadata" (
>
> L unsigned_long not null,
>
> A unsigned_long not null,
>
> R bigint not null,
>
> "s".W unsigned_long,
>
> "s".P bigint,
>
> "s".N varchar,
>
> "s".E varchar,
>
> "s".S unsigned_long,
>
> "s".M unsigned_long,
>
> "s".T unsigned_int,
>
> CONSTRAINT pk primary key (L,A,R,S:W)
>
> );
>
> Is that doable? Is there a specific syntax for that?
>
> Thanks,
>
> JM