hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Helmling <ghelml...@gmail.com>
Subject Re: can not delete one family
Date Thu, 10 Mar 2011 17:44:48 GMT
Sindy,

Are you trying to drop the column family completely from the table?

If so, you'll need to use HBaseAdmin.deleteColumn().

If you're only trying to remove values from the column family, then you will
need to specify a row, as Ted mentions.  And the table must be enabled to
handle the delete.

--gh


On Thu, Mar 10, 2011 at 2:19 AM, Sindy <sindybanana@gmail.com> wrote:

> Hi,
> I want to delete one family in the java programe,
> Here is my code:
> -----------------------------
>
>  Configuration conf=HBaseConfiguration.create();
>  HBaseAdmin admin = new HBaseAdmin(conf);
>
>  if (admin.tableExists(tableName)) {
>
>  HTable table = new HTable(conf,tableName);
>  Delete d=new Delete();
>  admin.disableTable(tableName);
>  d.deleteFamily(Bytes.toBytes(family));
>  table.delete(d);
>  admin.enableTable(tableName);
>  System.out.println("delete family ok!");
>  }
>  System.out.println("no this table ok!");
>  }
>
> -----------------------------
> But it shows the exception:
>
> Exception in thread "main" java.lang.IllegalArgumentException: Row is null
>  at org.apache.hadoop.hbase.KeyValue.createByteArray(KeyValue.java:434)
>  at org.apache.hadoop.hbase.KeyValue.<init>(KeyValue.java:399)
>  at org.apache.hadoop.hbase.KeyValue.<init>(KeyValue.java:368)
>  at org.apache.hadoop.hbase.KeyValue.<init>(KeyValue.java:347)
>  at org.apache.hadoop.hbase.KeyValue.<init>(KeyValue.java:317)
>  at org.apache.hadoop.hbase.client.Delete.deleteFamily(Delete.java:169)
>  at org.apache.hadoop.hbase.client.Delete.deleteFamily(Delete.java:148)
>  at DBOper.deleteOneFamily(DBOper.java:618)
>  at MainClass.main(MainClass.java:41)
>
>
> Could you give me any advices? Thanks
>
> --
> Sindy
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message