hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Subbiah, Suresh" <Suresh.Subb...@hp.com>
Subject RE: How to specify a compression algorithm when creating a table with the HBaseAdmin object?
Date Wed, 11 Jun 2014 23:34:02 GMT
Hi Jeremy,

Here is some code that creates an table using the HBaseAdmin API, with a bunch of options
such as compression and specified key boundaries.
http://pastebin.com/KNcv03bj

The user specified options will be in the StringArrayList tableOptions.

This is part of the Trafodion code @  https://github.com/trafodion/core

This code too follows the model that Jean-Marc has shown.

Thanks
Suresh


-----Original Message-----
From: Jean-Marc Spaggiari [mailto:jean-marc@spaggiari.org] 
Sent: Wednesday, June 11, 2014 4:55 PM
To: user
Subject: Re: How to specify a compression algorithm when creating a table with the HBaseAdmin
object?

      final HBaseAdmin admin = new HBaseAdmin(config);
      HTableDescriptor table = new
HTableDescriptor(TableName.valueOf(TABLE_NAME));
      table.addFamily(new
HColumnDescriptor(CF_DEFAULT).setCompressionType(Algorithm.SNAPPY));
      admin.createTable(table);


2014-06-11 17:47 GMT-04:00 jeremy p <athomewithagroovebox@gmail.com>:

> I'm currently creating a table using the HBaseAdmin object.  The 
> reason I'm doing it with the HBaseAdmin object is that I need to 
> pre-split the table by specifying the start key, end key, and number 
> of regions.  I want to use Snappy compression for this table, however, 
> I haven't seen any way to do this using the HBaseAdmin object.  In all 
> of the examples I've seen, they're creating the table from the HBase 
> shell.  How can I create a table with the HBaseAdmin object, and have that table use
Snappy compression?
>
> --Jeremy
>
Mime
View raw message