org.apache.hadoop.hbase.util
Interface RegionSplitter.SplitAlgorithm

All Known Implementing Classes:
RegionSplitter.HexStringSplit, RegionSplitter.UniformSplit
Enclosing class:
RegionSplitter

public static interface RegionSplitter.SplitAlgorithm

A generic interface for the RegionSplitter code to use for all it's functionality. Note that the original authors of this code use RegionSplitter.HexStringSplit to partition their table and set it as default, but provided this for your custom algorithm. To use, create a new derived class from this interface and call RegionSplitter.createPresplitTable(java.lang.String, org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm, java.lang.String[], org.apache.hadoop.conf.Configuration) or RegionSplitter#rollingSplit(String, String, Configuration) with the argument splitClassName giving the name of your class.


Method Summary
 byte[] firstRow()
          In HBase, the first row is represented by an empty byte array.
 byte[] lastRow()
          In HBase, the last row is represented by an empty byte array.
 String rowToStr(byte[] row)
           
 String separator()
           
 void setFirstRow(String userInput)
          In HBase, the last row is represented by an empty byte array.
 void setLastRow(String userInput)
          In HBase, the last row is represented by an empty byte array.
 byte[] split(byte[] start, byte[] end)
          Split a pre-existing region into 2 regions.
 byte[][] split(int numRegions)
          Split an entire table.
 byte[] strToRow(String input)
           
 

Method Detail

split

byte[] split(byte[] start,
             byte[] end)
Split a pre-existing region into 2 regions.

Parameters:
start - first row (inclusive)
end - last row (exclusive)
Returns:
the split row to use

split

byte[][] split(int numRegions)
Split an entire table.

Parameters:
numRegions - number of regions to split the table into
Returns:
array of split keys for the initial regions of the table. The length of the returned array should be numRegions-1.
Throws:
RuntimeException - user input is validated at this time. may throw a runtime exception in response to a parse failure

firstRow

byte[] firstRow()
In HBase, the first row is represented by an empty byte array. This might cause problems with your split algorithm or row printing. All your APIs will be passed firstRow() instead of empty array.

Returns:
your representation of your first row

lastRow

byte[] lastRow()
In HBase, the last row is represented by an empty byte array. This might cause problems with your split algorithm or row printing. All your APIs will be passed firstRow() instead of empty array.

Returns:
your representation of your last row

setFirstRow

void setFirstRow(String userInput)
In HBase, the last row is represented by an empty byte array. Set this value to help the split code understand how to evenly divide the first region.

Parameters:
userInput - raw user input (may throw RuntimeException on parse failure)

setLastRow

void setLastRow(String userInput)
In HBase, the last row is represented by an empty byte array. Set this value to help the split code understand how to evenly divide the last region. Note that this last row is inclusive for all rows sharing the same prefix.

Parameters:
userInput - raw user input (may throw RuntimeException on parse failure)

strToRow

byte[] strToRow(String input)
Parameters:
input - user or file input for row
Returns:
byte array representation of this row for HBase

rowToStr

String rowToStr(byte[] row)
Parameters:
row - byte array representing a row in HBase
Returns:
String to use for debug & file printing

separator

String separator()
Returns:
the separator character to use when storing / printing the row


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.