2016년 2월 5일 금요일

composite key in hive with hbase

CREATE TABLE hbase_table_3(key string, value2 int)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES (
"hbase.columns.mapping" = ":key,a:b"
);


INSERT OVERWRITE TABLE hbase_table_3
SELECT coalesce(concat(stock_symbol,'-',year(trade_date)),'NULL'), count(*)
FROM stock_trade
group by coalesce(concat(stock_symbol,'-',year(trade_date)),'NULL');