hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r693987 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/io/BatchUpdate.java src/test/org/apache/hadoop/hbase/client/TestBatchUpdate.java
Date Wed, 10 Sep 2008 21:13:22 GMT
Author: stack
Date: Wed Sep 10 14:13:21 2008
New Revision: 693987

URL: http://svn.apache.org/viewvc?rev=693987&view=rev
Log:
HBASE-882 The BatchUpdate class provides, put(col, cell) and delete(col) but no get().

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/io/BatchUpdate.java
    hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestBatchUpdate.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=693987&r1=693986&r2=693987&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Wed Sep 10 14:13:21 2008
@@ -64,6 +64,8 @@
                splits (Jonathan Gray via Stack)
    HBASE-877   HCM is unable to find table with multiple regions which contains
                binary (Jonathan Gray via Stack)
+   HBASE-822  The BatchUpdate class provides, put(col, cell) and delete(col)
+              but no get() (Ryan Smith via Stack)
 
   IMPROVEMENTS
    HBASE-801  When a table haven't disable, shell could response in a "user

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/io/BatchUpdate.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/io/BatchUpdate.java?rev=693987&r1=693986&r2=693987&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/io/BatchUpdate.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/io/BatchUpdate.java Wed Sep 10 14:13:21
2008
@@ -23,6 +23,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 
 import org.apache.hadoop.hbase.HConstants;
@@ -116,6 +117,31 @@
   public void setTimestamp(long timestamp) {
     this.timestamp = timestamp;
   }
+  
+  /**
+   * Get the current value of the specified column
+   * 
+   * @param column column name
+   * @return byte[] the cell value, returns null if the column does not exist.
+   */
+  public synchronized byte[] get(final String column) {
+	  return get(Bytes.toBytes(column));
+  }
+  
+  /**
+   * Get the current value of the specified column 
+   * 
+   * @param column column name
+   * @return byte[] the cell value, returns null if the column does not exist.
+   */
+  public synchronized byte[] get(final byte[] column) {
+	  for (BatchOperation operation: operations) {
+		  if (Arrays.equals(column, operation.getColumn())) {
+			  return operation.getValue();
+		  }
+	  }
+	  return null;
+  }
 
   /** 
    * Change a value for the specified column

Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestBatchUpdate.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestBatchUpdate.java?rev=693987&r1=693986&r2=693987&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestBatchUpdate.java (original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestBatchUpdate.java Wed Sep
10 14:13:21 2008
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Map;
 
 import org.apache.hadoop.hbase.HBaseClusterTestCase;
@@ -85,6 +86,8 @@
 
     bu = new BatchUpdate("row2");
     bu.put(CONTENTS, value);
+    byte[] getValue = bu.get(CONTENTS);
+    assertTrue(Arrays.equals(getValue, value));
     table.commit(bu);
 
     byte [][] columns = { CONTENTS };



Mime
View raw message