Package org.apache.accumulo.core.data
Class RowRange
java.lang.Object
org.apache.accumulo.core.data.RowRange
- All Implemented Interfaces:
Comparable<RowRange>
This class is used to specify a range of rows.
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic RowRangeall()Creates a range that includes all possible rows.asRange()Converts this row range to aRangeobject.static RowRangeatLeast(CharSequence lowerBound) Creates a range of rows greater than or equal to the given row.static RowRangeatLeast(org.apache.hadoop.io.Text lowerBound) Creates a range of rows greater than or equal to the given row.static RowRangeatMost(CharSequence upperBound) Creates a range of rows less than or equal to the given row.static RowRangeatMost(org.apache.hadoop.io.Text upperBound) Creates a range of rows less than or equal to the given row.Creates a row range which represents the intersection of this row range and the given row range.Creates a row range which represents the intersection of this row range and the given row range.static RowRangeclosed(CharSequence row) Creates a range that covers an entire row.static RowRangeclosed(CharSequence lowerBound, CharSequence upperBound) Creates a range of rows from lowerBound inclusive to upperBound inclusive.static RowRangeclosed(org.apache.hadoop.io.Text row) Creates a range that covers an entire row.static RowRangeclosed(org.apache.hadoop.io.Text lowerBound, org.apache.hadoop.io.Text upperBound) Creates a range of rows from lowerBound inclusive to upperBound inclusive.static RowRangeclosedOpen(CharSequence lowerBound, CharSequence upperBound) Creates a range of rows from lowerBound inclusive to upperBound exclusive.static RowRangeclosedOpen(org.apache.hadoop.io.Text lowerBound, org.apache.hadoop.io.Text upperBound) Creates a range of rows from lowerBound inclusive to upperBound exclusive.intCompares this row range to another row range.booleanDetermines if this row range contains the given row.booleancontains(org.apache.hadoop.io.Text row) Determines if this row range contains the given row.booleanbooleanDetermines if this row range equals another.org.apache.hadoop.io.Textorg.apache.hadoop.io.Textstatic RowRangegreaterThan(CharSequence lowerBound) Creates a range of rows strictly greater than the given row.static RowRangegreaterThan(org.apache.hadoop.io.Text lowerBound) Creates a range of rows strictly greater than the given row.inthashCode()booleanisAfter(org.apache.hadoop.io.Text that) booleanisBefore(org.apache.hadoop.io.Text that) booleanbooleanstatic RowRangelessThan(CharSequence upperBound) Creates a range of rows strictly less than the given row.static RowRangelessThan(org.apache.hadoop.io.Text upperBound) Creates a range of rows strictly less than the given row.mergeOverlapping(Collection<RowRange> rowRanges) Merges overlapping and adjacent row ranges.static RowRangeopen(CharSequence lowerBound, CharSequence upperBound) Creates a range of rows from lowerBound exclusive to upperBound exclusive.static RowRangeopen(org.apache.hadoop.io.Text lowerBound, org.apache.hadoop.io.Text upperBound) Creates a range of rows from lowerBound exclusive to upperBound exclusive.static RowRangeopenClosed(CharSequence lowerBound, CharSequence upperBound) Creates a range of rows from lowerBound exclusive to upperBound inclusive.static RowRangeopenClosed(org.apache.hadoop.io.Text lowerBound, org.apache.hadoop.io.Text upperBound) Creates a range of rows from lowerBound exclusive to upperBound inclusive.static RowRangerange(CharSequence lowerBound, boolean lowerBoundInclusive, CharSequence upperBound, boolean upperBoundInclusive) Creates a range of rows from the given lowerBound to the given upperBound.static RowRangerange(org.apache.hadoop.io.Text lowerBound, boolean lowerBoundInclusive, org.apache.hadoop.io.Text upperBound, boolean upperBoundInclusive) Creates a range of rows from the given lowerBound to the given upperBound.toString()
-
Method Details
-
all
Creates a range that includes all possible rows. -
open
public static RowRange open(org.apache.hadoop.io.Text lowerBound, org.apache.hadoop.io.Text upperBound) Creates a range of rows from lowerBound exclusive to upperBound exclusive.- Parameters:
lowerBound- starting rowupperBound- ending row- Throws:
IllegalArgumentException- if upper bound is before lower bound
-
open
Creates a range of rows from lowerBound exclusive to upperBound exclusive.- Parameters:
lowerBound- starting rowupperBound- ending row- Throws:
IllegalArgumentException- if upper bound is before lower bound
-
closed
public static RowRange closed(org.apache.hadoop.io.Text lowerBound, org.apache.hadoop.io.Text upperBound) Creates a range of rows from lowerBound inclusive to upperBound inclusive.- Parameters:
lowerBound- starting rowupperBound- ending row- Throws:
IllegalArgumentException- if upper bound is before lower bound
-
closed
Creates a range of rows from lowerBound inclusive to upperBound inclusive.- Parameters:
lowerBound- starting rowupperBound- ending row- Throws:
IllegalArgumentException- if upper bound is before lower bound
-
closed
Creates a range that covers an entire row.- Parameters:
row- row to cover
-
closed
Creates a range that covers an entire row.- Parameters:
row- row to cover
-
openClosed
public static RowRange openClosed(org.apache.hadoop.io.Text lowerBound, org.apache.hadoop.io.Text upperBound) Creates a range of rows from lowerBound exclusive to upperBound inclusive.- Parameters:
lowerBound- starting rowupperBound- ending row- Throws:
IllegalArgumentException- if upper bound is before lower bound
-
openClosed
Creates a range of rows from lowerBound exclusive to upperBound inclusive.- Parameters:
lowerBound- starting rowupperBound- ending row- Throws:
IllegalArgumentException- if upper bound is before lower bound
-
closedOpen
public static RowRange closedOpen(org.apache.hadoop.io.Text lowerBound, org.apache.hadoop.io.Text upperBound) Creates a range of rows from lowerBound inclusive to upperBound exclusive.- Parameters:
lowerBound- starting rowupperBound- ending row- Throws:
IllegalArgumentException- if upper bound is before lower bound
-
closedOpen
Creates a range of rows from lowerBound inclusive to upperBound exclusive.- Parameters:
lowerBound- starting rowupperBound- ending row- Throws:
IllegalArgumentException- if upper bound is before lower bound
-
greaterThan
Creates a range of rows strictly greater than the given row.- Parameters:
lowerBound- starting row
-
greaterThan
Creates a range of rows strictly greater than the given row.- Parameters:
lowerBound- starting row
-
atLeast
Creates a range of rows greater than or equal to the given row.- Parameters:
lowerBound- starting row
-
atLeast
Creates a range of rows greater than or equal to the given row.- Parameters:
lowerBound- starting row
-
lessThan
Creates a range of rows strictly less than the given row.- Parameters:
upperBound- ending row
-
lessThan
Creates a range of rows strictly less than the given row.- Parameters:
upperBound- ending row
-
atMost
Creates a range of rows less than or equal to the given row.- Parameters:
upperBound- ending row
-
atMost
Creates a range of rows less than or equal to the given row.- Parameters:
upperBound- ending row
-
range
public static RowRange range(org.apache.hadoop.io.Text lowerBound, boolean lowerBoundInclusive, org.apache.hadoop.io.Text upperBound, boolean upperBoundInclusive) Creates a range of rows from the given lowerBound to the given upperBound.- Parameters:
lowerBound- starting row; set to null for the smallest possible row (an empty one)lowerBoundInclusive- set to true to include lower bound, false to skipupperBound- ending row; set to null for positive infinityupperBoundInclusive- set to true to include upper bound, false to skip- Throws:
IllegalArgumentException- if upper bound is before lower bound
-
range
public static RowRange range(CharSequence lowerBound, boolean lowerBoundInclusive, CharSequence upperBound, boolean upperBoundInclusive) Creates a range of rows from the given lowerBound to the given upperBound.- Parameters:
lowerBound- starting row; set to null for the smallest possible row (an empty one)lowerBoundInclusive- set to true to include lower bound, false to skipupperBound- ending row; set to null for positive infinityupperBoundInclusive- set to true to include upper bound, false to skip- Throws:
IllegalArgumentException- if upper bound is before lower bound
-
getLowerBound
public org.apache.hadoop.io.Text getLowerBound() -
isLowerBoundInclusive
public boolean isLowerBoundInclusive()- Returns:
- true if the lower bound is inclusive or null, otherwise false
-
getUpperBound
public org.apache.hadoop.io.Text getUpperBound() -
isUpperBoundInclusive
public boolean isUpperBoundInclusive()- Returns:
- true if the upper bound is inclusive or null, otherwise false
-
asRange
Converts this row range to aRangeobject. -
isAfter
public boolean isAfter(org.apache.hadoop.io.Text that) - Parameters:
that- row to check- Returns:
- true if every row in this row range is greater than the given row, otherwise false
-
isBefore
public boolean isBefore(org.apache.hadoop.io.Text that) - Parameters:
that- row to check- Returns:
- true if every row in this row range is less than the given row, otherwise false
-
toString
-
hashCode
public int hashCode() -
equals
-
equals
Determines if this row range equals another.- Parameters:
other- range to compare- Returns:
- true if row ranges are equal, otherwise false
-
compareTo
Compares this row range to another row range. Compares in order: lower bound, inclusiveness of lower bound, upper bound, inclusiveness of upper bound. Infinite rows sort last, and non-infinite rows are compared withBinaryComparable.compareTo(BinaryComparable). When bounds are equal, inclusive lower bounds sort before exclusive ones, while inclusive upper bounds sort after exclusive ones.- Specified by:
compareToin interfaceComparable<RowRange>- Parameters:
other- row range to compare- Returns:
- comparison result
-
contains
Determines if this row range contains the given row.- Parameters:
row- row to check- Returns:
- true if the row is contained in the row range, otherwise false
-
contains
public boolean contains(org.apache.hadoop.io.Text row) Determines if this row range contains the given row.- Parameters:
row- row to check- Returns:
- true if the row is contained in the row range, otherwise false
-
mergeOverlapping
Merges overlapping and adjacent row ranges. Adjacent ranges are those that share an endpoint where at least one range includes that endpoint. For example, given the following input:[a,c], (c, d], (g,m), (j,t]
the following row ranges would be returned:[a,d], (g,t]
- Parameters:
rowRanges- the collection of row ranges to merge- Returns:
- a list of merged row ranges
-
clip
Creates a row range which represents the intersection of this row range and the given row range. The following example will print true.RowRange rowRange1 = RowRange.closed("a", "f"); RowRange rowRange2 = RowRange.closed("c", "n"); RowRange rowRange3 = rowRange1.clip(rowRange2); System.out.println(rowRange3.equals(RowRange.closed("c", "f")));- Parameters:
rowRange- row range to clip to- Returns:
- the intersection of this row range and the given row range
- Throws:
IllegalArgumentException- if row ranges do not overlap
-
clip
Creates a row range which represents the intersection of this row range and the given row range. Unlikeclip(RowRange), this method can optionally return null if the row ranges do not overlap, instead of throwing an exception. The returnNullIfDisjoint parameter controls this behavior.- Parameters:
rowRange- row range to clip toreturnNullIfDisjoint- true to return null if row ranges are disjoint, false to throw an exception- Returns:
- the intersection of this row range and the given row range, or null if row ranges do not overlap and returnNullIfDisjoint is true
- Throws:
IllegalArgumentException- if row ranges do not overlap and returnNullIfDisjoint is false- See Also:
-