Hive corresponds to HBase data type

Source: Internet
Author: User
Tags key string

Hive corresponds to HBase data type

When the Double,int type in hbase is stored in byte, it must be garbled to remove it with a string.

This problem is also encountered when HIVD and HBase are integrated: The practice is:#b

1. Add #b

CREATE EXTERNAL TABLE hivebig (key string,cust_name string,phone_num Int,brd_work_flux Double)

STORED by ' Org.apache.hadoop.hive.hbase.HBaseStorageHandler '
With Serdeproperties ("hbase.columns.mapping" = ": Key,bd:cust_name,bd:phone_num#b,bd:brd_work_flux#b")
Tblproperties ("hbase.table.name" = "bigtable2");


2. When #b is not added, the hive shell reads out garbled

CREATE EXTERNAL TABLE hivebig (key string,cust_name string,phone_num Int,brd_work_flux Double)

STORED by ' Org.apache.hadoop.hive.hbase.HBaseStorageHandler '
With Serdeproperties ("hbase.columns.mapping" = ": Key,bd:cust_name,Bd:phone_num,Bd:brd_work_flux")
Tblproperties ("hbase.table.name" = "bigtable2");
SELECT * from Hivebig;


SELECT * from Hivebig where phone_num > 1;

SELECT * from Hivebig where Brd_work_flux > 1555;


cf:val#s in the#sis a representation of typestring, Cf:foo does not have a configuration type, it is configured with Hbase.table.default.storage.type, #b为binary

Hive corresponds to HBase data type

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.