Index: src/java/org/apache/hadoop/hbase/regionserver/HRegion.java =================================================================== --- src/java/org/apache/hadoop/hbase/regionserver/HRegion.java (revision 674078) +++ src/java/org/apache/hadoop/hbase/regionserver/HRegion.java (working copy) @@ -1163,6 +1163,18 @@ for (HStore targetStore: stores.values()) { targetStore.getFull(key, columns, result); } + // Previous step won't fetch whole families. + // For each column names that are families, + // open the store related to it and fetch everything + // for that row. + if(columns != null) { + for (byte[] bs : columns) { + if(Bytes.toString(bs).split(":").length == 1) { + HStore store = stores.get(Bytes.mapKey(HStoreKey.getFamily(bs))); + store.getFull(key, null, result); + } + } + } return result; } finally { releaseRowLock(lid); Index: src/java/org/apache/hadoop/hbase/client/HTable.java =================================================================== --- src/java/org/apache/hadoop/hbase/client/HTable.java (revision 674078) +++ src/java/org/apache/hadoop/hbase/client/HTable.java (working copy) @@ -544,7 +544,7 @@ * Get selected columns for the specified row at the latest timestamp * * @param row row key - * @param columns Array of column names you want to retrieve. + * @param columns Array of column names and families you want to retrieve. * @return RowResult is empty if row does not exist. * @throws IOException */ @@ -557,7 +557,7 @@ * Get selected columns for the specified row at the latest timestamp * * @param row row key - * @param columns Array of column names you want to retrieve. + * @param columns Array of column names and families you want to retrieve. * @return RowResult is empty if row does not exist. * @throws IOException */ @@ -570,7 +570,7 @@ * Get selected columns for the specified row at the latest timestamp * * @param row row key - * @param columns Array of column names you want to retrieve. + * @param columns Array of column names and families you want to retrieve. * @return RowResult is empty if row does not exist. * @throws IOException */ @@ -583,7 +583,7 @@ * Get selected columns for the specified row at a specified timestamp * * @param row row key - * @param columns Array of column names you want to retrieve. + * @param columns Array of column names and families you want to retrieve. * @param ts timestamp * @return RowResult is empty if row does not exist. * @throws IOException @@ -598,7 +598,7 @@ * Get selected columns for the specified row at a specified timestamp * * @param row row key - * @param columns Array of column names you want to retrieve. + * @param columns Array of column names and families you want to retrieve. * @param ts timestamp * @return RowResult is empty if row does not exist. * @throws IOException @@ -613,7 +613,7 @@ * Get selected columns for the specified row at a specified timestamp * * @param row row key - * @param columns Array of column names you want to retrieve. + * @param columns Array of column names and families you want to retrieve. * @param ts timestamp * @return RowResult is empty if row does not exist. * @throws IOException Index: src/test/org/apache/hadoop/hbase/client/TestHTable.java =================================================================== --- src/test/org/apache/hadoop/hbase/client/TestHTable.java (revision 674078) +++ src/test/org/apache/hadoop/hbase/client/TestHTable.java (working copy) @@ -21,7 +21,6 @@ import java.io.IOException; import java.util.Map; - import org.apache.hadoop.hbase.HBaseClusterTestCase; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HConstants; @@ -148,8 +147,6 @@ */ public void testTableNotFoundExceptionWithATable() { try { - HColumnDescriptor column = - new HColumnDescriptor(COLUMN_FAMILY); HBaseAdmin admin = new HBaseAdmin(conf); HTableDescriptor testTableADesc = new HTableDescriptor("table"); @@ -169,4 +166,50 @@ } } + public void testGetRow() { + HTable table = null; + try { + HColumnDescriptor column2 = + new HColumnDescriptor(Bytes.toBytes("info2:")); + HBaseAdmin admin = new HBaseAdmin(conf); + HTableDescriptor testTableADesc = + new HTableDescriptor(tableAname); + testTableADesc.addFamily(column); + testTableADesc.addFamily(column2); + admin.createTable(testTableADesc); + + table = new HTable(conf, tableAname); + BatchUpdate batchUpdate = new BatchUpdate(row); + + for(int i = 0; i < 5; i++) + batchUpdate.put(COLUMN_FAMILY_STR+i, Bytes.toBytes(i)); + + table.commit(batchUpdate); + + RowResult result = null; + result = table.getRow(row, new byte[][] {COLUMN_FAMILY}); + for(int i = 0; i < 5; i++) + assertTrue(result.containsKey(Bytes.toBytes(COLUMN_FAMILY_STR+i))); + + result = table.getRow(row); + for(int i = 0; i < 5; i++) + assertTrue(result.containsKey(Bytes.toBytes(COLUMN_FAMILY_STR+i))); + + batchUpdate = new BatchUpdate(row); + batchUpdate.put("info2:a", Bytes.toBytes("a")); + table.commit(batchUpdate); + + result = table.getRow(row, new byte[][] { COLUMN_FAMILY, + Bytes.toBytes("info2:a") }); + for(int i = 0; i < 5; i++) + assertTrue(result.containsKey(Bytes.toBytes(COLUMN_FAMILY_STR+i))); + assertTrue(result.containsKey(Bytes.toBytes("info2:a"))); + + } catch (IOException e) { + e.printStackTrace(); + fail("Should not have any exception " + + e.getClass()); + } + } + }