title: Deleting columns from hbase
body: <p>I'm trying to find out how to deal with hbase. I have a problem deleting some columns from Hbase column family.
  I've created a table with a column family: </p>
  
  <pre><code>Configuration conf = HBaseConfiguration.create();
  HBaseAdmin hbase = new HBaseAdmin(conf);
  HTableDescriptor desc = new HTableDescriptor("new_table");
  HColumnDescriptor cf = new HColumnDescriptor("zz".getBytes());
  desc.addFamily(cf);
  hbase.createTable(desc);
  </code></pre>
  
  <p>Then, I've inserted some data into it: </p>
  
  <pre><code>private static void putData(int j) throws IOException {
      for (int i=1; i &lt;= j; i++) {
          String column = "EEE" + i;
          String value = "JJ" + i;
          HTable table = new HTable(conf, "new_table");
          Put p = new Put(Bytes.toBytes("zz"));
          p.add(Bytes.toBytes("zz"), Bytes.toBytes(column),
                    Bytes.toBytes(value));
          table.put(p);
      }
  }
  </code></pre>
  
  <p>After reading some docs, I've tried to delete everything from column family "zz" with this code: </p>
  
  <pre><code>    for (int i=1; i &lt;= 1000; i++) {
          String column = "EEE" + i;
          HTable table = new HTable(conf, "new_table");
          Delete delete = new Delete();
          delete.deleteColumns(Bytes.toBytes("zz"), Bytes.toBytes(column));
          table.delete(delete);
      }
  </code></pre>
  
  <p>But I got the exception: </p>
  
  <pre><code>13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.4.3-1240972, built on 02/06/2012 10:48 GMT
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:host.name=192.168.1.107
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:java.version=1.7.0-ea
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:java.home=/Library/Java/JavaVirtualMachines/JDK 1.7.0 Developer Preview.jdk/Contents/Home/jre
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:java.class.path=/Users/urijvoskresenskij/Documents/workspace/Hbase/bin:/Users/urijvoskresenskij/hbase-0.94.3/lib/activation-1.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/asm-3.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/avro-1.5.3.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/avro-ipc-1.5.3.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-beanutils-1.7.0.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-beanutils-core-1.8.0.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-cli-1.2.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-codec-1.4.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-collections-3.2.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-configuration-1.6.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-digester-1.8.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-el-1.0.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-httpclient-3.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-io-2.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-lang-2.5.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-logging-1.1.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-math-2.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/commons-net-1.4.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/core-3.1.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/guava-11.0.2.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/hadoop-core-1.0.4.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/high-scale-lib-1.1.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/httpclient-4.1.2.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/httpcore-4.1.3.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jackson-core-asl-1.8.8.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jackson-jaxrs-1.8.8.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jackson-mapper-asl-1.8.8.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jackson-xc-1.8.8.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jamon-runtime-2.3.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jasper-compiler-5.5.23.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jasper-runtime-5.5.23.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jaxb-api-2.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jaxb-impl-2.2.3-1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jersey-core-1.8.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jersey-json-1.8.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jersey-server-1.8.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jettison-1.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jetty-6.1.26.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jetty-util-6.1.26.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jruby-complete-1.6.5.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jsp-2.1-6.1.14.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jsp-api-2.1-6.1.14.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/jsr305-1.3.9.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/junit-4.10-HBASE-1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/libthrift-0.8.0.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/log4j-1.2.16.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/metrics-core-2.1.2.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/netty-3.2.4.Final.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/protobuf-java-2.4.0a.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/servlet-api-2.5-6.1.14.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/slf4j-api-1.4.3.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/slf4j-log4j12-1.4.3.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/snappy-java-1.0.3.2.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/stax-api-1.0.1.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/velocity-1.7.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/xmlenc-0.52.jar:/Users/urijvoskresenskij/hbase-0.94.3/lib/zookeeper-3.4.3.jar:/Users/urijvoskresenskij/hbase-0.94.3/hbase-0.94.3-tests.jar:/Users/urijvoskresenskij/hbase-0.94.3/hbase-0.94.3.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.aop-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.asm-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.aspects-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.beans-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.context-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.context.support-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.core-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.expression-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.instrument-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.instrument.tomcat-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.jdbc-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.jms-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.orm-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.oxm-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.test-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.transaction-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.web-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.web.portlet-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.web.servlet-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/dist/org.springframework.web.struts-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Downloads/commons-logging-1.1.1/commons-logging-1.1.1.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.web-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.aop-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.asm-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.aspects-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.beans-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.context-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.context.support-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.core-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.expression-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.instrument-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.instrument.tomcat-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.jdbc-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.jms-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.orm-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.oxm-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.test-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.transaction-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.web.portlet-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.web.servlet-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Desktop/spring-framework-3.1.3.RELEASE/src/org.springframework.web.struts-sources-3.1.3.RELEASE.jar:/Users/urijvoskresenskij/Downloads/commons-logging-1.1.1/commons-logging-1.1.1-javadoc.jar:/Users/urijvoskresenskij/Downloads/commons-logging-1.1.1/commons-logging-1.1.1-sources.jar:/Users/urijvoskresenskij/Downloads/commons-logging-1.1.1/commons-logging-adapters-1.1.1.jar:/Users/urijvoskresenskij/Downloads/commons-logging-1.1.1/commons-logging-api-1.1.1.jar:/Users/urijvoskresenskij/Downloads/commons-logging-1.1.1/commons-logging-tests.jar
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:java.library.path=/Users/urijvoskresenskij/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/var/folders/_q/z5blmlxs39d4pmmv1fj9mh500000gn/T/
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:java.compiler=&lt;NA&gt;
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:os.name=Mac OS X
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:os.arch=x86_64
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:os.version=10.7.5
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:user.name=urijvoskresenskij
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:user.home=/Users/urijvoskresenskij
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Client environment:user.dir=/Users/urijvoskresenskij/Documents/workspace/Hbase
  13/01/15 15:02:24 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
  13/01/15 15:02:24 INFO zookeeper.ClientCnxn: Opening socket connection to server /0:0:0:0:0:0:0:1:2181
  13/01/15 15:02:24 INFO zookeeper.RecoverableZooKeeper: The identifier of this process is 11768@MacBook-Air-Urij.local
  13/01/15 15:02:24 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
  13/01/15 15:02:24 INFO zookeeper.ClientCnxn: Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
  13/01/15 15:02:24 INFO zookeeper.ClientCnxn: Session establishment complete on server localhost/0:0:0:0:0:0:0:1:2181, sessionid = 0x13c3c95c6d50004, negotiated timeout = 40000
  Exception in thread "main" java.lang.IllegalArgumentException: Row is null
      at org.apache.hadoop.hbase.KeyValue.createByteArray(KeyValue.java:547)
      at org.apache.hadoop.hbase.KeyValue.&lt;init&gt;(KeyValue.java:436)
      at org.apache.hadoop.hbase.KeyValue.&lt;init&gt;(KeyValue.java:405)
      at org.apache.hadoop.hbase.KeyValue.&lt;init&gt;(KeyValue.java:384)
      at org.apache.hadoop.hbase.KeyValue.&lt;init&gt;(KeyValue.java:354)
      at org.apache.hadoop.hbase.client.Delete.deleteColumns(Delete.java:209)
      at org.apache.hadoop.hbase.client.Delete.deleteColumns(Delete.java:192)
      at MainHBase.deleteData(MainHBase.java:74)
      at MainHBase.main(MainHBase.java:85)
  </code></pre>
  
  <p>Maybe somebody knows how to delete data correctly?</p>