You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Jamie Murray <lj...@gmail.com> on 2014/11/18 20:58:10 UTC

Mapping to existing hbase table with a composite key

Hello,

I would like to map a Phoenix table to an existing hbase table that has a
composite key.  I would like each section of that composite key to be a
column.   Each section of the composite key has a fixed position and length

For example

Key:

myData1myData2myData3

Each of myDataN is 4 bytes in length and stored as a hex byte array.  I am
also mapping cf:cn to phoenix columns, but I haven't had any problems with
this.

They key sections are NOT delimited, I know each section by using fixed
position and length.

I have tried commands similar to:

CREATE VIEW "myTable"
(
  myData1 BINARY(4),
  myData2 BINARY(4),
  myData3 BINARY(4)
  "cf"."cn" UNSIGNED_LONG,
  pk BINARY(12) PRIMARY KEY (myData1, myData2, myData3)
);

with no success, any help would be appreciated.

Thanks,


Jamie

Re: Mapping to existing hbase table with a composite key

Posted by Jeffrey Zhong <jz...@hortonworks.com>.
There are several errors in your statement below:

1) when mapping, the column you specify should include its column family
name
2) In view creation, you can't do CONSTRAINT style like "PRIMARY KEY
(myData1, myData2, myData3)" but just PRIMARY KEY keyword

You can try something like following:

CREATE VIEW "myTable"
(
  myData1 BINARY(4),
  myData2 BINARY(4),
  myData3 BINARY(4),
  "cn" UNSIGNED_LONG,
  pk BINARY(12) PRIMARY KEY
) default_column_family='cf';


From:  Jamie Murray <lj...@gmail.com>
Reply-To:  <us...@phoenix.apache.org>
Date:  Tuesday, November 18, 2014 at 11:58 AM
To:  <us...@phoenix.apache.org>
Subject:  Mapping to existing hbase table with a composite key

Hello, 

I would like to map a Phoenix table to an existing hbase table that has a
composite key.  I would like each section of that composite key to be a
column.   Each section of the composite key has a fixed position and length

For example 

Key:

myData1myData2myData3

Each of myDataN is 4 bytes in length and stored as a hex byte array.  I am
also mapping cf:cn to phoenix columns, but I haven't had any problems with
this. 

They key sections are NOT delimited, I know each section by using fixed
position and length.

I have tried commands similar to:

CREATE VIEW "myTable"
(
  myData1 BINARY(4),
  myData2 BINARY(4),
  myData3 BINARY(4)
  "cf"."cn" UNSIGNED_LONG,
  pk BINARY(12) PRIMARY KEY (myData1, myData2, myData3)
);

with no success, any help would be appreciated.

Thanks, 


Jamie



-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.