To create a table exception when Hive/hbase is associated

Source: Internet
Author: User
Tags email string key string

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.