Try something like this:
CREATE EXTERNAL TABLE hbase_table_1(key struct<a:string,b:string,c:string>,
ROW FORMAT DELIMITED
COLLECTION ITEMS TERMINATED BY '~'
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" ":key,test-family:test-qual")
TBLPROPERTIES ("hbase.table.name" = "SIMPLE_TABLE");
Basically what you are doing here is that you are visualizing the composite
key as a struct and specifying that your keys in the composite key are
separated by a "~". After doing this, to GROUP BY any key in your composite
key, you simply run a query like:
select * from hbase_table_2 GROUP BY key.a;
This should give you your desired result.
Let me know if this works for you. We can then add this as a workaround on
On Tue, Jul 24, 2012 at 2:14 AM, ankit kinra <[EMAIL PROTECTED]> wrote:
> I have a use case in HBase + Hive Integration where HBase primary key is a
> composite key and the keys is separated by us with a custom delimiter. So
> basically it is Key = A~B~C.
> Now, I wanted to run a query on this HBase table using Hive and group by
> "A" (and not the complete primary key). I went through the following
> presentation :
> It says that this was implemented at StumbleUpon, anybody having any idea
> if that can be used by others.
> Also, there is this issue in JIRA :
> https://issues.apache.org/jira/browse/HIVE-2599 which talks about similar
> So it would be very helpful if anyone can give me some idea regarding this.
> Ankit Kinra