From fa829b301ebee9fa16b60bd5e2b5818df6fd1155 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 28 Oct 2008 05:03:13 +0000 Subject: [PATCH] HBASE-959 Be able to get multiple RowResult at one time from client side git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@708435 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ .../apache/hadoop/hbase/client/HTable.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 82431eb80d5..cfcbad1dc07 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -74,6 +74,8 @@ Release 0.19.0 - Unreleased HBASE-940 Make the TableOutputFormat batching-aware HBASE-967 [Optimization] Cache cell maximum length (HCD.getMaxValueLength); its used checking batch size + HBASE-959 Be able to get multiple RowResult at one time from client side + (Sishen Freecity via Stack) NEW FEATURES HBASE-875 Use MurmurHash instead of JenkinsHash [in bloomfilters] diff --git a/src/java/org/apache/hadoop/hbase/client/HTable.java b/src/java/org/apache/hadoop/hbase/client/HTable.java index 56508878fdc..016247026c9 100644 --- a/src/java/org/apache/hadoop/hbase/client/HTable.java +++ b/src/java/org/apache/hadoop/hbase/client/HTable.java @@ -1338,6 +1338,25 @@ public class HTable { return null; } + /** + * @param nbRows number of rows to return + * @return Between zero and nbRows RowResults + * @throws IOException + */ + public RowResult[] next(int nbRows) throws IOException { + // Collect values to be returned here + ArrayList resultSets = new ArrayList(nbRows); + for(int i = 0; i < nbRows; i++) { + RowResult next = next(); + if (next != null) { + resultSets.add(next); + } else { + break; + } + } + return resultSets.toArray(new RowResult[resultSets.size()]); + } + public void close() { if (callable != null) { callable.setClose();