Package org.apache.hadoop.hbase.util
Class RegionSplitter.NumberStringSplit
java.lang.Object
org.apache.hadoop.hbase.util.RegionSplitter.NumberStringSplit
- All Implemented Interfaces:
RegionSplitter.SplitAlgorithm
- Direct Known Subclasses:
RegionSplitter.DecimalStringSplit,RegionSplitter.HexStringSplit
- Enclosing class:
- RegionSplitter
public abstract static class RegionSplitter.NumberStringSplit
extends Object
implements RegionSplitter.SplitAlgorithm
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) String(package private) BigInteger(package private) String(package private) BigInteger(package private) int(package private) int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertToBigInteger(byte[] row) Returns the BigInteger represented by the byte arraybyte[]convertToByte(BigInteger bigInteger) Returns the bytes corresponding to the BigIntegerbyte[]convertToByte(BigInteger bigInteger, int pad) Returns the bytes corresponding to the BigIntegerbyte[][]convertToBytes(BigInteger[] bigIntegers) Returns an array of bytes corresponding to an array of BigIntegersbyte[]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 n) Split an entire table.split2(BigInteger a, BigInteger b) Divide 2 numbers in half (for split algorithm)byte[]user or file input for rowtoString()
-
Field Details
-
firstRow
-
firstRowInt
-
lastRow
-
lastRowInt
-
rowComparisonLength
-
radix
int radix
-
-
Constructor Details
-
NumberStringSplit
NumberStringSplit(String minRow, String maxRow, int radix)
-
-
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
-
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
-
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.
-
split2
Divide 2 numbers in half (for split algorithm)- Parameters:
a- number #1b- number #2- Returns:
- the midpoint of the 2 numbers
-
convertToBytes
Returns an array of bytes corresponding to an array of BigIntegers- Parameters:
bigIntegers- numbers to convert- Returns:
- bytes corresponding to the bigIntegers
-
convertToByte
Returns the bytes corresponding to the BigInteger- Parameters:
bigInteger- number to convertpad- padding length- Returns:
- byte corresponding to input BigInteger
-
convertToByte
Returns the bytes corresponding to the BigInteger- Parameters:
bigInteger- number to convert- Returns:
- corresponding bytes
-
convertToBigInteger
Returns the BigInteger represented by the byte array- Parameters:
row- byte array representing row- Returns:
- the corresponding BigInteger
-
toString
-