Issue 10556

Setup Hive over HBase

10556
Reporter: omeyn
Assignee: lfrancke
Type: NewFeature
Summary: Setup Hive over HBase
Priority: Major
Resolution: Fixed
Status: Closed
Created: 2011-12-27 15:54:04.434
Updated: 2013-12-17 15:16:55.879
Resolved: 2012-01-03 16:19:07.49


Author: lfrancke@gbif.org
Created: 2012-01-03 16:18:49.684
Updated: 2012-01-03 16:18:49.684
        
{code}
DROP TABLE IF EXISTS lars_hbase_ror;
CREATE EXTERNAL TABLE lars_hbase_ror (
  id int,
  data_provider_id int,
  data_resource_id int,
  resource_access_point_id int,
  institution_code string,
  collection_code string,
  catalogue_number string,
  scientific_name string,
  author string,
  rank string,
  kingdom string,
  phylum string,
  class string,
  order_rank string,
  family string,
  genus string,
  species string,
  subspecies string,
  latitude string,
  longitude string,
  lat_long_precision string,
  max_altitude string,
  min_altitude string,
  altitude_precision string,
  min_depth string,
  max_depth string,
  depth_precision string,
  continent_ocean string,
  country string,
  state_province string,
  county string,
  collector_name string,
  locality string,
  year string,
  month string,
  day string,
  basis_of_record string,
  identifier_name string,
  identification_date string,
  unit_qualifier string,
  created string,
  modified string,
  deleted string
)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,interp:data_provider_id,interp:data_resource_id,interp:resource_access_point_id,interp:institution_code,interp:collection_code,interp:catalogue_number,interp:scientific_name,interp:author,interp:rank,interp:kingdom,interp:phylum,interp:class,interp:order_rank,interp:family,interp:genus,interp:species,interp:subspecies,interp:latitude,interp:longitude,interp:lat_long_precision,interp:max_altitude,interp:min_altitude,interp:altitude_precision,interp:min_depth,interp:max_depth,interp:depth_precision,interp:continent_ocean,interp:country,interp:state_province,interp:county,interp:collector_name,interp:locality,interp:year,interp:month,interp:day,interp:basis_of_record,interp:identifier_name,interp:identification_date,interp:unit_qualifier,interp:created,interp:modified,interp:deleted")
TBLPROPERTIES("hbase.table.name" = "lars_ror");

# Running Hive
hive -hiveconf hbase.zookeeper.quorum=c1n1.gbif.org
ADD JAR zookeeper-3.3.1.jar;
ADD JAR hbase-0.90.4-cdh3u2.jar;
ADD JAR hive-hbase-handler-0.7.1-cdh3u2.jar;
ADD JAR guava-r06.jar;
SELECT * FROM lars_hbase_ror WHERE id > 100000 AND id <= 100100 ORDER by id;
{code}
    


Author: lfrancke@gbif.org
Comment: Works :)
Created: 2012-01-03 16:19:01.356
Updated: 2012-01-03 16:19:01.356