Index: src/java/org/apache/hadoop/hbase/client/Delete.java =================================================================== --- src/java/org/apache/hadoop/hbase/client/Delete.java (revision 787302) +++ src/java/org/apache/hadoop/hbase/client/Delete.java (working copy) @@ -87,13 +87,16 @@ /** * Create a Delete operation for the specified row and timestamp, using - * an optional row lock. - *

+ * an optional row lock.

+ * * If no further operations are done, this will delete all columns in all * families of the specified row with a timestamp less than or equal to the - * specified timestamp. + * specified timestamp.

+ * + * This timestamp is ONLY used for a delete row operation. If specifying + * families or columns, you must specify each timestamp individually. * @param row row key - * @param timestamp maximum version timestamp + * @param timestamp maximum version timestamp (only for delete row) * @param rowLock previously acquired row lock, or null */ public Delete(byte [] row, long timestamp, RowLock rowLock) { @@ -170,6 +173,18 @@ } /** + * Delete all versions of the specified column, given in + * family:qualifier notation, and with a timestamp less than + * or equal to the specified timestamp. + * @param column colon-delimited family and qualifier + * @param timestamp maximum version timestamp + */ + public void deleteColumns(byte [] column, long timestamp) { + byte [][] parts = KeyValue.parseColumn(column); + this.deleteColumns(parts[0], parts[1], timestamp); + } + + /** * Delete the latest version of the specified column. * This is an expensive call in that on the server-side, it first does a * get to find the latest versions timestamp. Then it adds a delete using Index: src/java/org/apache/hadoop/hbase/client/HTable.java =================================================================== --- src/java/org/apache/hadoop/hbase/client/HTable.java (revision 787302) +++ src/java/org/apache/hadoop/hbase/client/HTable.java (working copy) @@ -1411,7 +1411,9 @@ final RowLock rl) throws IOException { Delete d = new Delete(row, ts, rl); - d.deleteColumn(column); + if(column != null) { + d.deleteColumns(column, ts); + } delete(d); } @@ -1544,9 +1546,8 @@ public void deleteFamily(final byte [] row, final byte [] family, final long timestamp, final RowLock rl) throws IOException { - // Is this right? LATEST_TS? St.Ack Delete d = new Delete(row, HConstants.LATEST_TIMESTAMP, rl); - d.deleteFamily(family); + d.deleteFamily(stripColon(family), timestamp); delete(d); } @@ -2071,4 +2072,14 @@ }; } } + + private static byte [] stripColon(final byte [] n) { + byte col = n[n.length-1]; + if (col == ':') { + byte [] res = new byte[n.length-1]; + System.arraycopy(n, 0, res, 0, n.length-1); + return res; + } + return n; + } }