Package org.apache.hadoop.hbase.util
Class RegionSplitter.UniformSplit
java.lang.Object
org.apache.hadoop.hbase.util.RegionSplitter.UniformSplit
- All Implemented Interfaces:
RegionSplitter.SplitAlgorithm
- Enclosing class:
- RegionSplitter
public static class RegionSplitter.UniformSplit
extends Object
implements RegionSplitter.SplitAlgorithm
A SplitAlgorithm that divides the space of possible keys evenly. Useful when the keys are
approximately uniform random bytes (e.g. hashes). Rows are raw byte values in the range 00
=> FF and are right-padded with zeros to keep the same memcmp() order. This is the
natural algorithm to use for a byte[] environment and saves space, but is not necessarily the
easiest for readability.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) byte[](package private) byte[](package private) static final byte -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]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.rowToStr(byte[] row) byte array representing a row in HBaseReturns the separator character to use when storing / printing the rowvoidsetFirstRow(byte[] userInput) Set the first rowvoidsetFirstRow(String userInput) In HBase, the last row is represented by an empty byte array.voidsetLastRow(byte[] userInput) Set the last rowvoidsetLastRow(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(byte[] start, byte[] end, int numSplits, boolean inclusive) Some MapReduce jobs may want to run multiple mappers per region, this is intended for such usecase.byte[][]split(int numRegions) Split an entire table.byte[]user or file input for rowtoString()
-
Field Details
-
xFF
- See Also:
-
firstRowBytes
byte[] firstRowBytes -
lastRowBytes
byte[] lastRowBytes
-
-
Constructor Details
-
UniformSplit
public UniformSplit()
-
-
Method Details
-
split
Description copied from interface:RegionSplitter.SplitAlgorithmSplit a pre-existing region into 2 regions. first row (inclusive) last row (exclusive)- Specified by:
splitin interfaceRegionSplitter.SplitAlgorithm- Returns:
- the split row to use
-
split
Description copied from interface:RegionSplitter.SplitAlgorithmSplit an entire table. number of regions to split the table into user input is validated at this time. may throw a runtime exception in response to a parse failure- Specified by:
splitin interfaceRegionSplitter.SplitAlgorithm- Returns:
- array of split keys for the initial regions of the table. The length of the returned array should be numRegions-1.
-
split
Description copied from interface:RegionSplitter.SplitAlgorithmSome MapReduce jobs may want to run multiple mappers per region, this is intended for such usecase.- Specified by:
splitin interfaceRegionSplitter.SplitAlgorithm- Parameters:
start- first row (inclusive)end- last row (exclusive)numSplits- number of splits to generateinclusive- whether start and end are returned as split points
-
firstRow
Description copied from interface:RegionSplitter.SplitAlgorithmIn 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.- Specified by:
firstRowin interfaceRegionSplitter.SplitAlgorithm- Returns:
- your representation of your first row
-
lastRow
Description copied from interface:RegionSplitter.SplitAlgorithmIn 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.- Specified by:
lastRowin interfaceRegionSplitter.SplitAlgorithm- Returns:
- your representation of your last row
-
setFirstRow
Description copied from interface:RegionSplitter.SplitAlgorithmIn 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. raw user input (may throw RuntimeException on parse failure)- Specified by:
setFirstRowin interfaceRegionSplitter.SplitAlgorithm
-
setLastRow
Description copied from interface:RegionSplitter.SplitAlgorithmIn 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. raw user input (may throw RuntimeException on parse failure)- Specified by:
setLastRowin interfaceRegionSplitter.SplitAlgorithm
-
setFirstRow
Description copied from interface:RegionSplitter.SplitAlgorithmSet the first row- Specified by:
setFirstRowin interfaceRegionSplitter.SplitAlgorithm- Parameters:
userInput- byte array of the row key.
-
setLastRow
Description copied from interface:RegionSplitter.SplitAlgorithmSet the last row- Specified by:
setLastRowin interfaceRegionSplitter.SplitAlgorithm- Parameters:
userInput- byte array of the row key.
-
strToRow
Description copied from interface:RegionSplitter.SplitAlgorithmuser or file input for row- Specified by:
strToRowin interfaceRegionSplitter.SplitAlgorithm- Returns:
- byte array representation of this row for HBase
-
rowToStr
Description copied from interface:RegionSplitter.SplitAlgorithmbyte array representing a row in HBase- Specified by:
rowToStrin interfaceRegionSplitter.SplitAlgorithm- Returns:
- String to use for debug & file printing
-
separator
Description copied from interface:RegionSplitter.SplitAlgorithmReturns the separator character to use when storing / printing the row- Specified by:
separatorin interfaceRegionSplitter.SplitAlgorithm
-
toString
-