【问题标题】:Hive-Hbase integration - issues while inserting dataHive-Hbase 集成 - 插入数据时的问题
【发布时间】:2018-06-06 14:28:09
【问题描述】:

我能够成功地将 Hive 和 Hbase 集成到直接场景(无分区和分桶)。对于那些简单的场景,我能够在 Hive 和 hbase 中插入数据。

我遇到了存储在 Hbase 中的 Hive 分区表的问题。我能够执行“创建 DDL”语句。当我尝试执行插入时,我收到一条错误消息“必须指定表名”

CREATE TABLE hivehbase_customer(id int,holdid int,fname string,lname string,address string,zipcode string) 
partitioned by (city string) 
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' 
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,personal_data:hold_id,personal_data:f_name,personal_data:l_name,personal_address:address,personal_address:zipcode") 
TBLPROPERTIES ("hbase.table.name" = "hivehbase_custom", "hbase.mapred.output.outputtable" = "hivehbase_custom");

insert into table hivehbase_customer partition(city= 'tegacay') values (7394,NULL,NULL,NULL,NULL,29708);

【问题讨论】:

  • HBase 将如何映射您的 Hive 分区,因为 HBase 中没有这样的概念?
  • 我同意你的看法。但是,在文档中没有说“不支持分区”。创建 DDL 成功。此外,插入失败并显示奇怪的错误消息。所以,不确定它是否有效。
  • 好吧,因为 HBase 中没有任何东西可以实现某种分区,这是行不通的。无论如何要小心 HBase-Hive 集成:这主要用于开发或测试目的,但我不鼓励在大量生产中使用该功能。

标签: hive hbase


【解决方案1】:

尝试以下插入查询

insert into table hivehbase_customer partition(city) values (7394,NULL,NULL,NULL,NULL,29708,'tegacay');

实际分区的列需要在插入查询中指定为最后一列。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-29
    • 1970-01-01
    • 1970-01-01
    • 2014-09-05
    • 1970-01-01
    相关资源
    最近更新 更多