You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Jean-Marc Spaggiari <je...@spaggiari.org> on 2014/09/24 15:21:59 UTC

View composite key?

Hi,

Is it possible to create a view on and existing HBase table and describe
the composite key?

I don't see anything about that in the doc
http://phoenix.apache.org/views.html but it also doesn't say that it's not
possible.

Would like to do something like that:
CREATE VIEW "t1" ( USER unsigned_long PRIMARY KEY,
ID unsigned_long PRIMARY KEY,
VERSION unsigned_long PRIMARY KEY,
   "f1".A unsigned_long,
   "f1".R unsigned_long,
   "f1".L unsigned_long,
   "f1".W unsigned_long,
   "f1".P bigint,
   "f1".N varchar,
   "f1".E varchar,
   "f1".S unsigned_long,
   "f1".M unsigned_long,
   "f1".T unsigned_int
   );

Where USER, ID and VERSIONS are 8 bytes longs from my HBase rowkey.

Is that doable?

Thanks,

JM

Re: View composite key?

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Oh nice! Thanks for this example!

JM

2014-09-24 11:50 GMT-04:00 James Taylor <ja...@apache.org>:

> Hi JM,
> Sure, you'd do that like this:
>
> CREATE VIEW "t1" ( USER unsigned_long,
> ID unsigned_long,
> VERSION unsigned_long,
>    "f1".A unsigned_long,
>    "f1".R unsigned_long,
>    "f1".L unsigned_long,
>    "f1".W unsigned_long,
>    "f1".P bigint,
>    "f1".N varchar,
>    "f1".E varchar,
>    "f1".S unsigned_long,
>    "f1".M unsigned_long,
>    "f1".T unsigned_int,
>    CONSTRAINT pk PRIMARY KEY (USER, ID, VERSION)
>    );
>
> Thanks,
> James
>
> On Wed, Sep 24, 2014 at 6:21 AM, Jean-Marc Spaggiari
> <je...@spaggiari.org> wrote:
> > Hi,
> >
> > Is it possible to create a view on and existing HBase table and describe
> the
> > composite key?
> >
> > I don't see anything about that in the doc
> > http://phoenix.apache.org/views.html but it also doesn't say that it's
> not
> > possible.
> >
> > Would like to do something like that:
> > CREATE VIEW "t1" ( USER unsigned_long PRIMARY KEY,
> > ID unsigned_long PRIMARY KEY,
> > VERSION unsigned_long PRIMARY KEY,
> >    "f1".A unsigned_long,
> >    "f1".R unsigned_long,
> >    "f1".L unsigned_long,
> >    "f1".W unsigned_long,
> >    "f1".P bigint,
> >    "f1".N varchar,
> >    "f1".E varchar,
> >    "f1".S unsigned_long,
> >    "f1".M unsigned_long,
> >    "f1".T unsigned_int
> >    );
> >
> > Where USER, ID and VERSIONS are 8 bytes longs from my HBase rowkey.
> >
> > Is that doable?
> >
> > Thanks,
> >
> > JM
>

Re: View composite key?

Posted by James Taylor <ja...@apache.org>.
Hi JM,
Sure, you'd do that like this:

CREATE VIEW "t1" ( USER unsigned_long,
ID unsigned_long,
VERSION unsigned_long,
   "f1".A unsigned_long,
   "f1".R unsigned_long,
   "f1".L unsigned_long,
   "f1".W unsigned_long,
   "f1".P bigint,
   "f1".N varchar,
   "f1".E varchar,
   "f1".S unsigned_long,
   "f1".M unsigned_long,
   "f1".T unsigned_int,
   CONSTRAINT pk PRIMARY KEY (USER, ID, VERSION)
   );

Thanks,
James

On Wed, Sep 24, 2014 at 6:21 AM, Jean-Marc Spaggiari
<je...@spaggiari.org> wrote:
> Hi,
>
> Is it possible to create a view on and existing HBase table and describe the
> composite key?
>
> I don't see anything about that in the doc
> http://phoenix.apache.org/views.html but it also doesn't say that it's not
> possible.
>
> Would like to do something like that:
> CREATE VIEW "t1" ( USER unsigned_long PRIMARY KEY,
> ID unsigned_long PRIMARY KEY,
> VERSION unsigned_long PRIMARY KEY,
>    "f1".A unsigned_long,
>    "f1".R unsigned_long,
>    "f1".L unsigned_long,
>    "f1".W unsigned_long,
>    "f1".P bigint,
>    "f1".N varchar,
>    "f1".E varchar,
>    "f1".S unsigned_long,
>    "f1".M unsigned_long,
>    "f1".T unsigned_int
>    );
>
> Where USER, ID and VERSIONS are 8 bytes longs from my HBase rowkey.
>
> Is that doable?
>
> Thanks,
>
> JM