Browse Source

HADOOP-2401 Add convenience put method that takes writable

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@584844 13f79535-47bb-0310-9956-ffa450edef68
Michael Stack 18 years ago
parent
commit
eb6801e74f

+ 13 - 0
src/contrib/hbase/CHANGES.txt

@@ -2,6 +2,19 @@ HBase Change Log
 
 
 Trunk (unreleased changes)
+  INCOMPATIBLE CHANGES
+
+  NEW FEATURES
+
+  OPTIMIZATIONS
+
+  BUG FIXES
+
+  IMPROVEMENTS
+    HADOOP-2401 Add convenience put method that takes writable
+                (Johan Oskarsson via Stack)
+
+Branch 0.15 (unreleased changes)
 
   INCOMPATIBLE CHANGES
     HADOOP-1931 Hbase scripts take --ARG=ARG_VALUE when should be like hadoop

+ 15 - 0
src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTable.java

@@ -35,6 +35,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.filter.RowFilterInterface;
 import org.apache.hadoop.hbase.io.BatchUpdate;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import org.apache.hadoop.hbase.util.Writables;
 import org.apache.hadoop.io.MapWritable;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.Writable;
@@ -545,6 +546,20 @@ public class HTable implements HConstants {
     batch.get().put(lockid, column, val);
   }
   
+  /** 
+   * Change a value for the specified column.
+   * Runs {@link #abort(long)} if exception thrown.
+   *
+   * @param lockid lock id returned from startUpdate
+   * @param column column whose value is being set
+   * @param val new value for column
+   * @throws IOException throws this if the writable can't be
+   * converted into a byte array 
+   */
+  public void put(long lockid, Text column, Writable val) throws IOException {    
+    put(lockid, column, Writables.getBytes(val));
+  }
+  
   /** 
    * Delete the value for a column.
    * Deletes the cell whose row/column/commit-timestamp match those of the