Package org.apache.flink.runtime.state
Class KeyGroupRange
java.lang.Object
org.apache.flink.runtime.state.KeyGroupRange
- All Implemented Interfaces:
Serializable,Iterable<Integer>,KeyGroupsList
This class defines a range of key-group indexes. Key-groups are the granularity into which the
keyspace of a job is partitioned for keyed state-handling in state backends. The boundaries of
the range are inclusive.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionKeyGroupRange(int startKeyGroup, int endKeyGroup) Defines the range [startKeyGroup, endKeyGroup] -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(int keyGroup) Checks whether or not a single key-group is contained in the range.booleanintgetIntersection(KeyGroupRange other) Create a range that represent the intersection between this range and the given range.intgetKeyGroupId(int idx) Returns the id of the keygroup at the given index, where index in interval [0,KeyGroupsList.getNumberOfKeyGroups()[.intReturns the number of key group ids in the list.intinthashCode()iterator()static KeyGroupRangeof(int startKeyGroup, int endKeyGroup) Factory method that also handles creation of empty key-groups.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EMPTY_KEY_GROUP_RANGE
The empty key-group
-
-
Constructor Details
-
KeyGroupRange
public KeyGroupRange(int startKeyGroup, int endKeyGroup) Defines the range [startKeyGroup, endKeyGroup]- Parameters:
startKeyGroup- start of the range (inclusive)endKeyGroup- end of the range (inclusive)
-
-
Method Details
-
contains
public boolean contains(int keyGroup) Checks whether or not a single key-group is contained in the range.- Specified by:
containsin interfaceKeyGroupsList- Parameters:
keyGroup- Key-group to check for inclusion.- Returns:
- True, only if the key-group is in the range.
-
getIntersection
Create a range that represent the intersection between this range and the given range.- Parameters:
other- A KeyGroupRange to intersect.- Returns:
- Key-group range that is the intersection between this and the given key-group range.
-
getNumberOfKeyGroups
public int getNumberOfKeyGroups()Description copied from interface:KeyGroupsListReturns the number of key group ids in the list.- Specified by:
getNumberOfKeyGroupsin interfaceKeyGroupsList- Returns:
- The number of key-groups in the range
-
getStartKeyGroup
public int getStartKeyGroup()- Returns:
- The first key-group in the range.
-
getEndKeyGroup
public int getEndKeyGroup()- Returns:
- The last key-group in the range.
-
getKeyGroupId
public int getKeyGroupId(int idx) Description copied from interface:KeyGroupsListReturns the id of the keygroup at the given index, where index in interval [0,KeyGroupsList.getNumberOfKeyGroups()[.- Specified by:
getKeyGroupIdin interfaceKeyGroupsList- Parameters:
idx- the index into the list- Returns:
- key group id at the given index
-
equals
-
hashCode
public int hashCode() -
toString
-
prettyPrintInterval
-
iterator
-
of
Factory method that also handles creation of empty key-groups.- Parameters:
startKeyGroup- start of the range (inclusive)endKeyGroup- end of the range (inclusive)- Returns:
- the key-group from start to end or an empty key-group range.
-