From 4231f3f5ca6446eba20a3de2b750fa4674ad81f3 Mon Sep 17 00:00:00 2001 From: Igor Katkov Date: Tue, 30 Sep 2014 10:53:28 -0700 Subject: [PATCH] Added getStartEndKeys() implementation in scala, so that client code can get tablesplits --- .../org/kiji/testing/fakehtable/FakeHTable.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/scala/org/kiji/testing/fakehtable/FakeHTable.scala b/src/main/scala/org/kiji/testing/fakehtable/FakeHTable.scala index 423a8ae..70549d3 100644 --- a/src/main/scala/org/kiji/testing/fakehtable/FakeHTable.scala +++ b/src/main/scala/org/kiji/testing/fakehtable/FakeHTable.scala @@ -661,6 +661,21 @@ class FakeHTable( // ----------------------------------------------------------------------------------------------- // HTable methods that are not part of HTableInterface, but required anyway: + + def getStartEndKeys(): org.apache.hadoop.hbase.util.Pair[Array[Array[Byte]], Array[Array[Byte]]] = { + val list: JList[HRegionInfo] = getRegions + val startKey = Array.ofDim[Byte](list.size(), 0) + val endKey = Array.ofDim[Byte](list.size(), 0) + + for( i <- 0 until list.size()) { + val hregioninfo:HRegionInfo = list.get(i) + startKey :+ hregioninfo.getStartKey + endKey :+ hregioninfo.getEndKey + } + + return new org.apache.hadoop.hbase.util.Pair(startKey, endKey) + } + /** See HTable.getRegionLocation(). */ def getRegionLocation(row: String): HRegionLocation = { return getRegionLocation(Bytes.toBytes(row))