Hi,
I want to add a column family to a existing table. I used the following code
but it shows that descriptor cannot be modified.

 try {
            HTableDescriptor descriptor = new
HTable(table.getConfiguration(),table.getTableName()).getTableDescriptor();
            descriptor.addFamily(cf);

        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use
File | Settings | File Templates.
        }

then I used the code,

try {
            HTableDescriptor descriptor = new
HTableDescriptor(table.getTableDescriptor());
            descriptor.addFamily(cf);
            table.flushCommits();
            System.out.println(descriptor.hasFamily(groupId.getBytes()));
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use
File | Settings | File Templates.
        }
But this code does not add a column family to the table.

I need your help to figure this out.
thanks

-- 
Eranda Sooriyabandara
Blog: http://www.emsooriyabandara.blogspot.com/
LInkedIn: http://lk.linkedin.com/in/erandasooriyabandara

Reply via email to