Hive> CREATE TABLE Hperson (ID string, name String,email string) STORED by ' Org.apache.hadoop.hive.hbase.HBaseStorageHandler ' with serdeproperties ("hbase.columns.mapping" = ": id,cf1:name,cf2 : Email ") tblproperties (" hbase.table.name "=" Hbperson ");
FAILED: Error in Metadata:java.lang.RuntimeException:MetaException (message:o Rg.apache.hadoop.hive.serde2.SerDeException Org.apache.hadoop.hive.hbase.HBaseSerDe:columns has 3 elements while Hbase.columns.mapping has 4 elements (counting the key if implicit))
When you create a table associated with a hive/hbase, the HBASE table structure defaults to a field key, and if there is no field ' key ' that appears in the CREATE TABLE, you will create your own, so that the hive corresponding table will be problematic. So in hive corresponding table must add key This field, in order to avoid this problem, in the HBase tables structure can be displayed in the Add ' key ' field, so it is not easy to problem.
The correct format is as follows:
CREATE TABLE Hperson1 (key string,id string, name String,email string) STORED by ' Org.apache.hadoop.hive.hbase.HBaseStorageHandler ' with serdeproperties ("hbase.columns.mapping" = "cf0:id,cf1:name, Cf2:email ") tblproperties (" hbase.table.name "=" hbperson1 ");
Or:
CREATE TABLE Hperson1 (key string,id string, name String,email string) STORED by ' Org.apache.hadoop.hive.hbase.HBaseStorageHandler ' with serdeproperties ("hbase.columns.mapping" = ": key,cf0:id,cf1: Name,cf2:email ") tblproperties (" hbase.table.name "=" hbperson1 ");
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/database/extra/