hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "zengchuan (Commented) (JIRA)" <>
Subject [jira] [Commented] (HIVE-1245) allow access to values stored as non-strings in HBase
Date Tue, 13 Mar 2012 08:13:41 GMT


zengchuan commented on HIVE-1245:

I'm new to hbase and hive. I create a table in hbase and add data array into it.

    public static void createTable(String tablename) throws IOException{  
        HBaseAdmin admin = new HBaseAdmin(hbaseConfig);  
            System.out.println("table Exists!!!");  
            HTableDescriptor tableDesc = new HTableDescriptor(tablename);  
            tableDesc.addFamily(new HColumnDescriptor("dom"));  

    public static void addData(String tablename) throws IOException{  
        HTable table=new HTable(hbaseConfig,tablename); 
        	Put put = new Put(Bytes.toBytes(String.valueOf(i)));
	        List<String> a = new ArrayList<String>();
	        Object obj = doType(hbaseConfig, a, List.class);
	        Writable w = new HbaseObjectWritable(obj);
	        byte[] depthMapByteArray = WritableUtils.toByteArray(w);

    private static Object doType(Configuration conf, Object value,
    	      Class<?> clazz)
    	  throws IOException {
    	    ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
    	    DataOutputStream out = new DataOutputStream(byteStream);
    	    HbaseObjectWritable.writeObject(out, value, clazz, conf);
    	    ByteArrayInputStream bais =
    	      new ByteArrayInputStream(byteStream.toByteArray());
    	    DataInputStream dis = new DataInputStream(bais);
    	    Object product = HbaseObjectWritable.readObject(dis, conf);
    	    return product;

in hive i create a table

CREATE EXTERNAL TABLE hbase_table_2(row_key int, domain Array<String>) 
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,dom:domain")
TBLPROPERTIES("" = "table2");

in hbase_table_2   domain Array<String> is not right. why?
> allow access to values stored as non-strings in HBase
> -----------------------------------------------------
>                 Key: HIVE-1245
>                 URL:
>             Project: Hive
>          Issue Type: Improvement
>          Components: HBase Handler
>    Affects Versions: 0.6.0
>            Reporter: John Sichi
>            Assignee: Basab Maulik
> See  test case in

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message