为了将hive与HBASE集成,我在hive中创建了下表。它已成功创建,我可以直接从HIVE和HBASE访问该表。
问题是当我从HIVE向表中插入覆盖数据时,我只看到数据出现在HBASE中。当我从Hive执行SELECT COUNT(*)FROM T_PONNMS_ONT_4时,它返回0.然而,当我从同一个表的HBASE查询记录计数时,显示所有5000万条记录。是否有这种情况的原因?
%1
通过HIVE将数据插入HBASE表
CREATE TABLE IF NOT EXISTS T_PONNMS_ONT_4
(
TRANSACTIONORIGIN STRING,
TRANSACTIONID INT,
TRANSACTIONTIME STRING,
TRANSACTIONTYPE STRING,
ONT_UNIQUEID STRING,
ONT_SHELFNUM STRING,
ONTNUM STRING,
ONT_SERIALNUM STRING,
ONT_VENDOR STRING,
ONT_MODEL STRING,
ONT_STATUS STRING)
PARTITIONED BY (FILENAME STRING, TRANSACTION_DATE STRING)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ('hbase.columns.mapping' = 'cf:TRANSACTIONORIGIN,
cf:TRANSACTIONID,
cf:TRANSACTIONTIME,
cf:TRANSACTIONTYPE,
:key,
cf:ONT_SHELFNUM,
cf:ONTNUM,
cf:ONT_SERIALNUM,
cf:ONT_VENDOR,
cf:ONT_MODEL,
cf:ONT_STATUS')
TBLPROPERTIES ('hbase.table.name' = 'T_PONNMS_ONT_4');
HIVE> SELECT COUNT(*)FROM T_PONNMS_4; 好 0 时间为0.241
HBASE>计数' T_PONNMS_ONT_4' 返还5000万