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
Modifier and TypeFieldDescription(package private) String
(package private) BigInteger
(package private) String
(package private) BigInteger
(package private) int
(package private) int
-
Constructor Summary
-
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 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 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.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
-
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
-
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.
-
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
-