I have created the following HBase table using Hive as the following:
CREATE TABLE HBWeather (key struct<USAF:INT, WBAN:INT, `Date`:STRING>, TEMP INT)
ROW FORMAT DELIMITED
COLLECTION ITEMS TERMINATED BY '~'
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ('hbase.columns.mapping'=':key,T:Temp')
TBLPROPERTIES("hbase.table.name"="HBWeather", "hbase.mapred.output.outputtable"="HBWeather");
then fill it with data:
Insert overwrite table HBWeather select NAMED_STRUCT('USAF',USAF, 'WBAN',WBAN,'Date', `Date`) key, TEMP from weather;
running the following returns the expected result:
select * from hbweather limited 10;
Now my question is, how can I filter by a specific key when my key is struct? for example if I want to find the TEMP where USAF is 400010, wban is 99999, and date = '200906280000', how to write that?... how the where clause will look like when filtering on a key of type struct?
select * from hbweather where key.usaf=400010 and key.wban=99999 and key.`date`='199906280000' limit 10;