hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r771545 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
Date Tue, 05 May 2009 03:57:26 GMT
Author: stack
Date: Tue May  5 03:57:26 2009
New Revision: 771545

URL: http://svn.apache.org/viewvc?rev=771545&view=rev
Log:
HBASE-889 The current Thrift API does not allow a new scanner to be created without supplying
a column list unlike the other APIs.

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=771545&r1=771544&r2=771545&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Tue May  5 03:57:26 2009
@@ -193,6 +193,9 @@
                (Evgeny Ryabitskiy via Stack)
    HBASE-1112  we will lose data if the table name happens to be the logs' dir
                name (Samuel Guo via Stack)
+   HBASE-889   The current Thrift API does not allow a new scanner to be
+               created without supplying a column list unlike the other APIs.
+               (Tim Sell via Stack)
 
 Release 0.19.0 - 01/21/2009
   INCOMPATIBLE CHANGES

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java?rev=771545&r1=771544&r2=771545&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java Tue May 
5 03:57:26 2009
@@ -81,6 +81,22 @@
     protected HashMap<Integer, Scanner> scannerMap = null;
     
     /**
+     * Returns a list of all the column families for a given htable.
+     * 
+     * @param table
+     * @return
+     * @throws IOException
+     */
+    byte[][] getAllColumns(HTable table) throws IOException {
+      HColumnDescriptor[] cds = table.getTableDescriptor().getColumnFamilies();
+      byte[][] columns = new byte[cds.length][];
+      for (int i = 0; i < cds.length; i++) {
+        columns[i] = cds[i].getNameWithColon();
+      }
+      return columns;
+    }
+          
+    /**
      * Creates and returns an HTable instance from a given table name.
      * 
      * @param tableName
@@ -468,9 +484,13 @@
         List<byte[]> columns) throws IOError {
       try {
         HTable table = getTable(tableName);
-        Scanner scanner = table.getScanner(columns.toArray(new byte[0][]),
-            startRow);
-        return addScanner(scanner);
+        byte[][] columnsArray = null;
+        if ((columns == null) || (columns.size() == 0)) {
+          columnsArray = getAllColumns(table);
+        } else {
+          columnsArray = columns.toArray(new byte[0][]);
+        }
+        return addScanner(table.getScanner(columnsArray, startRow));
       } catch (IOException e) {
         throw new IOError(e.getMessage());
       }
@@ -480,9 +500,13 @@
         byte[] stopRow, List<byte[]> columns) throws IOError, TException {
       try {
         HTable table = getTable(tableName);
-        Scanner scanner = table.getScanner(columns.toArray(new byte[0][]),
-            startRow, stopRow);
-        return addScanner(scanner);
+        byte[][] columnsArray = null;
+        if ((columns == null) || (columns.size() == 0)) {
+          columnsArray = getAllColumns(table);
+        } else {
+          columnsArray = columns.toArray(new byte[0][]);
+        }
+        return addScanner(table.getScanner(columnsArray, startRow, stopRow));
       } catch (IOException e) {
         throw new IOError(e.getMessage());
       }
@@ -492,9 +516,13 @@
         List<byte[]> columns, long timestamp) throws IOError, TException {
       try {
         HTable table = getTable(tableName);
-        Scanner scanner = table.getScanner(columns.toArray(new byte[0][]),
-            startRow, timestamp);
-        return addScanner(scanner);
+        byte[][] columnsArray = null;
+        if ((columns == null) || (columns.size() == 0)) {
+          columnsArray = getAllColumns(table);
+        } else {
+          columnsArray = columns.toArray(new byte[0][]);
+        }
+        return addScanner(table.getScanner(columnsArray, startRow, timestamp));
       } catch (IOException e) {
         throw new IOError(e.getMessage());
       }
@@ -505,9 +533,14 @@
         throws IOError, TException {
       try {
         HTable table = getTable(tableName);
-        Scanner scanner = table.getScanner(columns.toArray(new byte[0][]),
-            startRow, stopRow, timestamp);
-        return addScanner(scanner);
+        byte[][] columnsArray = null;
+        if ((columns == null) || (columns.size() == 0)) {
+          columnsArray = getAllColumns(table);
+        } else {
+          columnsArray = columns.toArray(new byte[0][]);
+        }
+        return addScanner(table.getScanner(columnsArray, startRow, stopRow,
+            timestamp));
       } catch (IOException e) {
         throw new IOError(e.getMessage());
       }



Mime
View raw message