hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raw...@apache.org
Subject svn commit: r1073976 [1/3] - in /hbase/branches/0.90: ./ src/main/java/org/apache/hadoop/hbase/thrift/ src/main/java/org/apache/hadoop/hbase/thrift/generated/ src/main/resources/org/apache/hadoop/hbase/thrift/ src/test/java/org/apache/hadoop/hbase/thrift/
Date Wed, 23 Feb 2011 22:56:12 GMT
Author: rawson
Date: Wed Feb 23 22:56:12 2011
New Revision: 1073976

URL: http://svn.apache.org/viewvc?rev=1073976&view=rev
Log:
HBASE-3542  MultiGet methods in Thrift

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java
    hbase/branches/0.90/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
    hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1073976&r1=1073975&r2=1073976&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Wed Feb 23 22:56:12 2011
@@ -4,6 +4,9 @@ Release 0.90.2 - February 9th, 2011
    HBASE-3545  Possible liveness issue with MasterServerAddress in
                HRegionServer getMaster (Greg Bowyer via Stack)
    HBASE-3548  Fix type in documentation of pseudo distributed mode
+  
+  IMPROVEMENTS
+   HBASE-3542  MultiGet methods in Thrift
     
 
 Release 0.90.1 - February 9th, 2011

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java?rev=1073976&r1=1073975&r2=1073976&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java Wed
Feb 23 22:56:12 2011
@@ -398,6 +398,52 @@ public class ThriftServer {
       }
     }
 
+    public List<TRowResult> getRows(byte[] tableName, List<byte[]> rows)
+        throws IOError {
+      return getRowsWithColumnsTs(tableName, rows, null,
+                                  HConstants.LATEST_TIMESTAMP);
+    }
+
+    public List<TRowResult> getRowsWithColumns(byte[] tableName, List<byte[]>
rows,
+        List<byte[]> columns) throws IOError {
+      return getRowsWithColumnsTs(tableName, rows, columns,
+                                  HConstants.LATEST_TIMESTAMP);
+    }
+
+    public List<TRowResult> getRowsTs(byte[] tableName, List<byte[]> rows,
+        long timestamp) throws IOError {
+      return getRowsWithColumnsTs(tableName, rows, null,
+                                  timestamp);
+    }
+
+    public List<TRowResult> getRowsWithColumnsTs(byte[] tableName, List<byte[]>
rows,
+        List<byte[]> columns, long timestamp) throws IOError {
+      try {
+        List<Get> gets = new ArrayList<Get>(rows.size());
+        HTable table = getTable(tableName);
+        for (byte[] row : rows) {
+          Get get = new Get(row);
+          if (columns != null) {
+            byte[][] columnArr = columns.toArray(new byte[columns.size()][]);
+            for(byte [] column : columnArr) {
+              byte [][] famAndQf = KeyValue.parseColumn(column);
+              if (famAndQf.length == 1) {
+                get.addFamily(famAndQf[0]);
+              } else {
+                get.addColumn(famAndQf[0], famAndQf[1]);
+              }
+            }
+            get.setTimeRange(Long.MIN_VALUE, timestamp);
+          }
+          gets.add(get);
+        }
+        Result[] result = table.get(gets);
+        return ThriftUtilities.rowResultFromHBase(result);
+      } catch (IOException e) {
+        throw new IOError(e.getMessage());
+      }
+    }
+
     public void deleteAll(byte[] tableName, byte[] row, byte[] column)
         throws IOError {
       deleteAllTs(tableName, row, column, HConstants.LATEST_TIMESTAMP);



Mime
View raw message