HBASE-3542 MultiGet methods in Thrift
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1073979 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
71fcacea91
commit
8811bed468
|
@ -107,6 +107,9 @@ Release 0.90.2 - Unreleased
|
|||
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 - Unreleased
|
||||
|
||||
NEW FEATURES
|
||||
|
|
|
@ -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);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -364,6 +364,72 @@ service Hbase {
|
|||
4:i64 timestamp
|
||||
) throws (1:IOError io)
|
||||
|
||||
/**
|
||||
* Get all the data for the specified table and rows at the latest
|
||||
* timestamp. Returns an empty list if no rows exist.
|
||||
*
|
||||
* @return TRowResult containing the rows and map of columns to TCells
|
||||
*/
|
||||
list<TRowResult> getRows(
|
||||
/** name of table */
|
||||
1:Text tableName,
|
||||
|
||||
/** row keys */
|
||||
2:list<Text> rows
|
||||
) throws (1:IOError io)
|
||||
|
||||
/**
|
||||
* Get the specified columns for the specified table and rows at the latest
|
||||
* timestamp. Returns an empty list if no rows exist.
|
||||
*
|
||||
* @return TRowResult containing the rows and map of columns to TCells
|
||||
*/
|
||||
list<TRowResult> getRowsWithColumns(
|
||||
/** name of table */
|
||||
1:Text tableName,
|
||||
|
||||
/** row keys */
|
||||
2:list<Text> rows
|
||||
|
||||
/** List of columns to return, null for all columns */
|
||||
3:list<Text> columns
|
||||
) throws (1:IOError io)
|
||||
|
||||
/**
|
||||
* Get all the data for the specified table and rows at the specified
|
||||
* timestamp. Returns an empty list if no rows exist.
|
||||
*
|
||||
* @return TRowResult containing the rows and map of columns to TCells
|
||||
*/
|
||||
list<TRowResult> getRowsTs(
|
||||
/** name of the table */
|
||||
1:Text tableName,
|
||||
|
||||
/** row keys */
|
||||
2:list<Text> rows
|
||||
|
||||
/** timestamp */
|
||||
3:i64 timestamp
|
||||
) throws (1:IOError io)
|
||||
|
||||
/**
|
||||
* Get the specified columns for the specified table and rows at the specified
|
||||
* timestamp. Returns an empty list if no rows exist.
|
||||
*
|
||||
* @return TRowResult containing the rows and map of columns to TCells
|
||||
*/
|
||||
list<TRowResult> getRowsWithColumnsTs(
|
||||
/** name of table */
|
||||
1:Text tableName,
|
||||
|
||||
/** row keys */
|
||||
2:list<Text> rows
|
||||
|
||||
/** List of columns to return, null for all columns */
|
||||
3:list<Text> columns,
|
||||
4:i64 timestamp
|
||||
) throws (1:IOError io)
|
||||
|
||||
/**
|
||||
* Apply a series of mutations (updates/deletes) to a row in a
|
||||
* single transaction. If an exception is thrown, then the
|
||||
|
|
Loading…
Reference in New Issue