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
Modifier and TypeFieldDescription(package private) byte[]
(package private) byte[]
(package private) static final byte
-
Constructor Summary
-
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 rowvoid
setFirstRow
(byte[] userInput) Set the first rowvoid
setFirstRow
(String userInput) In HBase, the last row is represented by an empty byte array.void
setLastRow
(byte[] userInput) Set the last rowvoid
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
(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.SplitAlgorithm
Split a pre-existing region into 2 regions. first row (inclusive) last row (exclusive)- Specified by:
split
in interfaceRegionSplitter.SplitAlgorithm
- Returns:
- the split row to use
-
split
Description copied from interface:RegionSplitter.SplitAlgorithm
Split 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:
split
in 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.SplitAlgorithm
Some MapReduce jobs may want to run multiple mappers per region, this is intended for such usecase.- Specified by:
split
in 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.SplitAlgorithm
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.- Specified by:
firstRow
in interfaceRegionSplitter.SplitAlgorithm
- Returns:
- your representation of your first row
-
lastRow
Description copied from interface:RegionSplitter.SplitAlgorithm
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.- Specified by:
lastRow
in interfaceRegionSplitter.SplitAlgorithm
- Returns:
- your representation of your last row
-
setFirstRow
Description copied from interface:RegionSplitter.SplitAlgorithm
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. raw user input (may throw RuntimeException on parse failure)- Specified by:
setFirstRow
in interfaceRegionSplitter.SplitAlgorithm
-
setLastRow
Description copied from interface:RegionSplitter.SplitAlgorithm
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. raw user input (may throw RuntimeException on parse failure)- Specified by:
setLastRow
in interfaceRegionSplitter.SplitAlgorithm
-
setFirstRow
Description copied from interface:RegionSplitter.SplitAlgorithm
Set the first row- Specified by:
setFirstRow
in interfaceRegionSplitter.SplitAlgorithm
- Parameters:
userInput
- byte array of the row key.
-
setLastRow
Description copied from interface:RegionSplitter.SplitAlgorithm
Set the last row- Specified by:
setLastRow
in interfaceRegionSplitter.SplitAlgorithm
- Parameters:
userInput
- byte array of the row key.
-
strToRow
Description copied from interface:RegionSplitter.SplitAlgorithm
user or file input for row- Specified by:
strToRow
in interfaceRegionSplitter.SplitAlgorithm
- Returns:
- byte array representation of this row for HBase
-
rowToStr
Description copied from interface:RegionSplitter.SplitAlgorithm
byte array representing a row in HBase- Specified by:
rowToStr
in interfaceRegionSplitter.SplitAlgorithm
- Returns:
- String to use for debug & file printing
-
separator
Description copied from interface:RegionSplitter.SplitAlgorithm
Returns the separator character to use when storing / printing the row- Specified by:
separator
in interfaceRegionSplitter.SplitAlgorithm
-
toString
-