如何使用指向 hbase table 的复杂数据类型创建外部配置单元 table?

How to create external hive table with complex data types which points to hbase table?

我有一个 hbase table,其中包含列族(姓名、联系人)和列、姓名(字符串)、年龄(字符串)、工作街道(字符串)、工作城市(字符串)、工作状态(字符串)。

我想创建一个指向此 hbase table 的外部配置单元 table,其中包含以下列。
姓名(字符串)、年龄(字符串)、地址(结构)。

CREATE EXTERNAL TABLE hiveTable(id INT,name STRING, age STRING, 
address STRUCT<Street:STRING,City:STRING,State:STRING>) 
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' 
WITH SERDEPROPERTIES ("hbase.columns.mapping" ="Name:name,Name:age,Contact:workStreet, Contact:workCity, Contact:workState") 
TBLPROPERTIES("hbase.table.name" = "hbaseTable");

它运行变成了下面的错误,

Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.RuntimeException:
MetaException(message:org.apache.hadoop.hive.serde2.SerDeException org.apache.hadoop.hive.hbase.HBaseSerDe: columns has 3 elements while hbase.columns.mapping
has 5 elements (counting the key if implicit))

我尝试过使用 Map 而不是 Struct。下面是查询,

CREATE EXTERNAL TABLE hiveTable(id INT,name STRING,age STRING,
                           address MAP<String,String>) 
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' 
WITH SERDEPROPERTIES ("hbase.columns.mapping" = "Name:name,Name:,Contact:") 
TBLPROPERTIES("hbase.table.name" = "hbaseTable");