From 2ec772096efc5365e5d8678f5d6675f955da353d Mon Sep 17 00:00:00 2001 From: Nitay Joffe Date: Thu, 9 Jul 2009 23:27:09 +0000 Subject: [PATCH] HBASE-1637 Delete client class methods should return itself like Put, Get, Scan (Jon Gray via Nitay) git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@792746 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ .../apache/hadoop/hbase/client/Delete.java | 26 ++++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 99baa2803cb..efd5f6b8f66 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -454,6 +454,8 @@ Release 0.20.0 - Unreleased HBASE-1626 Allow emitting Deletes out of new TableReducer (Lars George via Stack) HBASE-1551 HBase should manage multiple node ZooKeeper quorum + HBASE-1637 Delete client class methods should return itself like Put, Get, + Scan (Jon Gray via Nitay) OPTIMIZATIONS HBASE-1412 Change values for delete column and column family in KeyValue diff --git a/src/java/org/apache/hadoop/hbase/client/Delete.java b/src/java/org/apache/hadoop/hbase/client/Delete.java index c38ab639b5d..30e48a9bcc9 100644 --- a/src/java/org/apache/hadoop/hbase/client/Delete.java +++ b/src/java/org/apache/hadoop/hbase/client/Delete.java @@ -132,8 +132,9 @@ public class Delete implements Writable { * specified family. * @param family family name */ - public void deleteFamily(byte [] family) { - this.deleteFamily(family, HConstants.LATEST_TIMESTAMP); + public Delete deleteFamily(byte [] family) { + this.deleteFamily(family, HConstants.LATEST_TIMESTAMP); + return this; } /** @@ -145,7 +146,7 @@ public class Delete implements Writable { * @param family family name * @param timestamp maximum version timestamp */ - public void deleteFamily(byte [] family, long timestamp) { + public Delete deleteFamily(byte [] family, long timestamp) { List list = familyMap.get(family); if(list == null) { list = new ArrayList(); @@ -154,6 +155,7 @@ public class Delete implements Writable { } list.add(new KeyValue(row, family, null, timestamp, KeyValue.Type.DeleteFamily)); familyMap.put(family, list); + return this; } /** @@ -161,8 +163,9 @@ public class Delete implements Writable { * @param family family name * @param qualifier column qualifier */ - public void deleteColumns(byte [] family, byte [] qualifier) { + public Delete deleteColumns(byte [] family, byte [] qualifier) { this.deleteColumns(family, qualifier, HConstants.LATEST_TIMESTAMP); + return this; } /** @@ -172,7 +175,7 @@ public class Delete implements Writable { * @param qualifier column qualifier * @param timestamp maximum version timestamp */ - public void deleteColumns(byte [] family, byte [] qualifier, long timestamp) { + public Delete deleteColumns(byte [] family, byte [] qualifier, long timestamp) { List list = familyMap.get(family); if (list == null) { list = new ArrayList(); @@ -180,6 +183,7 @@ public class Delete implements Writable { list.add(new KeyValue(this.row, family, qualifier, timestamp, KeyValue.Type.DeleteColumn)); familyMap.put(family, list); + return this; } /** @@ -189,9 +193,10 @@ public class Delete implements Writable { * @param column colon-delimited family and qualifier * @param timestamp maximum version timestamp */ - public void deleteColumns(byte [] column, long timestamp) { + public Delete deleteColumns(byte [] column, long timestamp) { byte [][] parts = KeyValue.parseColumn(column); this.deleteColumns(parts[0], parts[1], timestamp); + return this; } /** @@ -202,8 +207,9 @@ public class Delete implements Writable { * @param family family name * @param qualifier column qualifier */ - public void deleteColumn(byte [] family, byte [] qualifier) { + public Delete deleteColumn(byte [] family, byte [] qualifier) { this.deleteColumn(family, qualifier, HConstants.LATEST_TIMESTAMP); + return this; } /** @@ -212,7 +218,7 @@ public class Delete implements Writable { * @param qualifier column qualifier * @param timestamp version timestamp */ - public void deleteColumn(byte [] family, byte [] qualifier, long timestamp) { + public Delete deleteColumn(byte [] family, byte [] qualifier, long timestamp) { List list = familyMap.get(family); if(list == null) { list = new ArrayList(); @@ -220,6 +226,7 @@ public class Delete implements Writable { list.add(new KeyValue( this.row, family, qualifier, timestamp, KeyValue.Type.Delete)); familyMap.put(family, list); + return this; } /** @@ -227,9 +234,10 @@ public class Delete implements Writable { * family:qualifier notation. * @param column colon-delimited family and qualifier */ - public void deleteColumn(byte [] column) { + public Delete deleteColumn(byte [] column) { byte [][] parts = KeyValue.parseColumn(column); this.deleteColumn(parts[0], parts[1], HConstants.LATEST_TIMESTAMP); + return this; } /**