FAQ
Hi,

  i have a question. We are creating this Hive table to take data from HBase
and putting it in Hive so that we can query this table from Impala right?
So when we create a table in Hive, there should be data in HBase right?
In the below example:

More than 1 attributes in Hive is mapped to each of the column families in
HBase.
So can you please tell me how does it work? I mean how is the data in bools
or ints or floats or string?

Examples of Querying HBase Tables from Impala

You can map an HBase table to a Hive table with or without string row keys.
The following examples use HBase with the following table definition:

create 'hbasealltypessmall', 'bools', 'ints', 'floats', 'strings'
enable 'hbasealltypessmall'

Without a String Row Key

CREATE EXTERNAL TABLE hbasealltypessmall (
   id int,
   bool_col boolean,
   tinyint_col tinyint,
   smallint_col smallint,
   int_col int,
   bigint_col bigint,
   float_col float,
   double_col double,
   date_string_col string,
   string_col string,
   timestamp_col timestamp)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES (
   "hbase.columns.mapping" =
   ":key,bools:bool_col,ints:tinyint_col,ints:smallint_col,ints:int_col,ints:bigint_col,floats\
    :float_col,floats:double_col,strings:date_string_col,strings:string_col,strings:timestamp_col"
)
TBLPROPERTIES("hbase.table.name" = "hbasealltypessmall")

Search Discussions

  • Darren Lo at Jul 8, 2013 at 5:11 pm
    Mapping a Hbase table to a Hive table just means that you can treat an
    HBase table as if it were a Hive table. The underlying data is stored in
    HBase and there is no data movement / data copy. That's what "STORED BY"
    means.

    You can find the source code for HBaseStorageHandler and figure out how it
    works for yourself. It's probably fairly straightforward.

    Thanks,
    Darren

    On Sun, Jul 7, 2013 at 11:02 PM, nancy jean wrote:

    Hi,

    i have a question. We are creating this Hive table to take data from
    HBase and putting it in Hive so that we can query this table from Impala
    right?
    So when we create a table in Hive, there should be data in HBase right?
    In the below example:

    More than 1 attributes in Hive is mapped to each of the column families in
    HBase.
    So can you please tell me how does it work? I mean how is the data in
    bools or ints or floats or string?

    Examples of Querying HBase Tables from Impala

    You can map an HBase table to a Hive table with or without string row
    keys. The following examples use HBase with the following table definition:

    create 'hbasealltypessmall', 'bools', 'ints', 'floats', 'strings'
    enable 'hbasealltypessmall'

    Without a String Row Key

    CREATE EXTERNAL TABLE hbasealltypessmall (
    id int,
    bool_col boolean,
    tinyint_col tinyint,
    smallint_col smallint,
    int_col int,
    bigint_col bigint,
    float_col float,
    double_col double,
    date_string_col string,
    string_col string,
    timestamp_col timestamp)
    STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
    WITH SERDEPROPERTIES (
    "hbase.columns.mapping" =
    ":key,bools:bool_col,ints:tinyint_col,ints:smallint_col,ints:int_col,ints:bigint_col,floats\
    :float_col,floats:double_col,strings:date_string_col,strings:string_col,strings:timestamp_col"
    )
    TBLPROPERTIES("hbase.table.name" = "hbasealltypessmall")

    --
    Thanks,
    Darren

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupimpala-user @
categorieshadoop
postedJul 8, '13 at 6:02a
activeJul 8, '13 at 5:11p
posts2
users2
websitecloudera.com
irc#hadoop

2 users in discussion

Darren Lo: 1 post Nancy jean: 1 post

People

Translate

site design / logo © 2022 Grokbase