Class IntegerSplitter
- java.lang.Object
-
- com.amazonaws.athena.connectors.jdbc.splits.IntegerSplitter
-
- All Implemented Interfaces:
Splitter<Integer>
,Iterator<SplitRange<Integer>>
public class IntegerSplitter extends Object implements Splitter<Integer>
Integer splits iterator. Guarantees number of splits expected of a split range. Uses `(high-low)/numSplits + 1` as step to calculate splits. For a non-zero remainder `r`, extra value will be added to first `r` splits. Example: [1, 10] as input split range 1. expected splits = 2, remainder = 0 Splits = [1,5], [6,10] 2. expected splits = 3, remainder = 1 Splits = [1,4], [5,7], [8,10] // note that the remainder gets added in first split only. 3. expected splits = 4, remainder = 2 Splits = [1,3], [4,6], [7,8], [9,10] // note that the remainder gets distributed in first two splits.
-
-
Constructor Summary
Constructors Constructor Description IntegerSplitter(SplitInfo<Integer> splitInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
SplitRange<Integer>
next()
String
nextRangeClause()
Provides the next split clause to be used in SQL queries.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceIterator<SplitRange<Integer>>
-
next
public SplitRange<Integer> next()
- Specified by:
next
in interfaceIterator<SplitRange<Integer>>
-
nextRangeClause
public String nextRangeClause()
Description copied from interface:Splitter
Provides the next split clause to be used in SQL queries.- Specified by:
nextRangeClause
in interfaceSplitter<Integer>
- Returns:
- SQL clause for the range, both endpoints inclusive.
-
-