Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # user - Issues adding column families


Copy link to this message
-
Re: Issues adding column families
Asaf Mesika 2013-06-20, 18:12
if (!admin.tableExists(tableName)){

Shouldn't it be:
if (admin.tableExists(tableName)){

?
On Thu, Jun 20, 2013 at 6:42 PM, Aji Janis <[EMAIL PROTECTED]> wrote:

> I have the following function for adding column family but its not working
> for some reason. I am able to get proper configuration and establish the
> right connection. Can anyone explain whats wrong?
>
> Hbase version: http://archive.cloudera.com/cdh/3/*hbase-0.90.6-cdh3u5*
> /apidocs/ <http://archive.cloudera.com/cdh/3/hbase-0.90.6-cdh3u5/apidocs/>
> Thanks in advance.
>
>
> public void addFamily(String tableName, ArrayList<String> families) throws
> IOException{
> admin = new HBaseAdmin(getConfiguration());
> if (!admin.tableExists(tableName)){
> if (families !=null){
> admin.disableTable(tableName);
> for (String fam: families) {
> System.out.println("family to add: "+ fam);
> admin.addColumn(tableName, new
>
>     HColumnDescriptor(fam));
> }
> admin.enableTable(tableName);
> }
> admin.close();
> }
> }
>