Created 05-22-2018 07:59 AM
Hi guys,
I have a table in hbase like shown below:
hbase(main):005:0> scan 'glookups'
ROW COLUMN+CELL
UDS.WT_PRD_MD.MR column=lk:lval, timestamp=1526974749860, value=Denver
UDS.WT_PRD_MD.MR column=lk:val, timestamp=1526974739603, value=DN
1 row(s) in 0.0230 seconds
now I wanted it to map to hive table and the script is shown below:
create EXTERNAL TABLE global_lookups(key String,val String,lvl String)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES
("hbase.columns.mapping"=":key,lk:lvl,lk:val")TBLPROPERTIES("hbase.table.name"="EOS:globallookups");
which works fine .But my scenario is bit different I want the row key to be splitted and stored in different columns in hive for example if this my row key UDS.WT_PRD_MD.MR
I want UDS should be in one column
WT_PRD_MD in one column
and the value of lk:lval in one column
and the value of lk:val in another column
I wrote the following script but it's not working
create EXTERNAL TABLE global_lookups(sorname String,fieldname String,fieldCode String,fieldDescription String)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES
("hbase.columns.mapping"=":key.subString(0,3),:key.subString(5,14),lk:lvl,lk:val")TBLPROPERTIES("hbase.table.name"="EOS:globallookups");
How can I achieve this ???