Index: src/main/java/org/apache/hadoop/hbase/client/Delete.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/Delete.java (revision 1245861) +++ src/main/java/org/apache/hadoop/hbase/client/Delete.java (working copy) @@ -119,25 +119,6 @@ } /** - * Advanced use only. Create a Delete object based on a KeyValue - * of type "delete". - * @param kv - * @throws IOException - */ - public Delete(KeyValue kv) throws IOException { - this(kv.getRow(), kv.getTimestamp(), null); - if (!kv.isDelete()) { - throw new IOException("The recently added KeyValue is not of type " - + "delete. Rowkey: " + Bytes.toStringBinary(this.row)); - } - // can't use singletonList, because this might be modified at the server by - // coprocessors - ArrayList list = new ArrayList(1); - list.add(kv); - familyMap.put(kv.getFamily(), list); - } - - /** * Advanced use only. * Add an existing delete marker to this Delete object. * @param kv An existing KeyValue of type "delete". Index: src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java (revision 1245861) +++ src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java (working copy) @@ -74,6 +74,7 @@ private void writeResult(ImmutableBytesWritable key, Result result, Context context) throws IOException, InterruptedException { Put put = null; + Delete delete = null; for (KeyValue kv : result.raw()) { if(cfRenameMap != null) { // If there's a rename mapping for this CF, create a new KeyValue @@ -95,13 +96,13 @@ kv.getValueLength()); // value length } } + // Deletes and Puts are gathered and written when finished if (kv.isDelete()) { - // Deletes need to be written one-by-one, - // since family deletes overwrite column(s) deletes - context.write(key, new Delete(kv)); + if (delete == null) { + delete = new Delete(key.get()); + } + delete.addDeleteMarker(kv); } else { - // Puts are gathered into a single Put object - // and written when finished if (put == null) { put = new Put(key.get()); } @@ -111,6 +112,9 @@ if (put != null) { context.write(key, put); } + if (delete != null) { + context.write(key, delete); + } } @Override