Package org.apache.gravitino.stats
Class PartitionRange
java.lang.Object
org.apache.gravitino.stats.PartitionRange
PartitionRange represents a range of partitions defined by lower and upper partition names.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum representing the type of bounds for a partition range. -
Method Summary
Modifier and TypeMethodDescriptionstatic PartitionRange
between
(String lowerPartitionName, PartitionRange.BoundType lowerBoundType, String upperPartitionName, PartitionRange.BoundType upperBoundType) Creates a PartitionRange which has both lower and upper partition names.static PartitionRange
between
(String lowerPartitionName, PartitionRange.BoundType lowerBoundType, String upperPartitionName, PartitionRange.BoundType upperBoundType, SortOrder comparator) Creates a PartitionRange which has both lower and upper partition names with a specific comparator type.Returns a comparator for comparing partitions within this range.static PartitionRange
downTo
(String lowerPartitionName, PartitionRange.BoundType lowerBoundType) Creates a PartitionRange which only has lower bound partition name.static PartitionRange
downTo
(String lowerPartitionName, PartitionRange.BoundType lowerBoundType, SortOrder comparator) Creates a PartitionRange which only has lower bound partition name with a specific comparator type.Returns the type of the lower bound if it exists.Returns the lower partition name if it exists.Returns the type of the upper bound if it exists.Returns the upper partition name if it exists.static PartitionRange
upTo
(String upperPartitionName, PartitionRange.BoundType upperBoundType) Creates a PartitionRange which only has upper bound partition name.static PartitionRange
upTo
(String upperPartitionName, PartitionRange.BoundType upperBoundType, SortOrder comparator) Creates a PartitionRange which only has upper bound partition name with a specific comparator type.
-
Method Details
-
upTo
public static PartitionRange upTo(String upperPartitionName, PartitionRange.BoundType upperBoundType) Creates a PartitionRange which only has upper bound partition name.- Parameters:
upperPartitionName
- the upper partition name.upperBoundType
- the type of the upper bound (open or closed).- Returns:
- a PartitionRange with the upper partition name.
-
upTo
public static PartitionRange upTo(String upperPartitionName, PartitionRange.BoundType upperBoundType, SortOrder comparator) Creates a PartitionRange which only has upper bound partition name with a specific comparator type.- Parameters:
upperPartitionName
- the upper partition name.upperBoundType
- the type of the upper bound (open or closed).comparator
- the comparator to use for this range.- Returns:
- a PartitionRange with the upper partition name and the specified comparator type.
-
downTo
public static PartitionRange downTo(String lowerPartitionName, PartitionRange.BoundType lowerBoundType) Creates a PartitionRange which only has lower bound partition name.- Parameters:
lowerPartitionName
- the lower partition name.lowerBoundType
- the type of the lower bound (open or closed).- Returns:
- a PartitionRange with the lower partition name.
-
downTo
public static PartitionRange downTo(String lowerPartitionName, PartitionRange.BoundType lowerBoundType, SortOrder comparator) Creates a PartitionRange which only has lower bound partition name with a specific comparator type.- Parameters:
lowerPartitionName
- the lower partition name.lowerBoundType
- the type of the lower bound (open or closed).comparator
- the comparator to use for this range.- Returns:
- a PartitionRange with the lower partition name and the specified comparator type.
-
between
public static PartitionRange between(String lowerPartitionName, PartitionRange.BoundType lowerBoundType, String upperPartitionName, PartitionRange.BoundType upperBoundType) Creates a PartitionRange which has both lower and upper partition names.- Parameters:
lowerPartitionName
- the lower partition name.lowerBoundType
- the type of the lower bound (open or closed).upperPartitionName
- the upper partition name.upperBoundType
- the type of the upper bound (open or closed).- Returns:
- a PartitionRange with both lower and upper partition names.
-
between
public static PartitionRange between(String lowerPartitionName, PartitionRange.BoundType lowerBoundType, String upperPartitionName, PartitionRange.BoundType upperBoundType, SortOrder comparator) Creates a PartitionRange which has both lower and upper partition names with a specific comparator type.- Parameters:
lowerPartitionName
- the lower partition name.lowerBoundType
- the type of the lower bound (open or closed).upperPartitionName
- the upper partition name.upperBoundType
- the type of the upper bound (open or closed).comparator
- the comparator to use for this range.- Returns:
- a PartitionRange with both lower and upper partition names and the specified comparator type.
-
lowerPartitionName
Returns the lower partition name if it exists.- Returns:
- an Optional containing the lower partition name if it exists, otherwise an empty Optional.
-
upperPartitionName
Returns the upper partition name if it exists.- Returns:
- an Optional containing the upper partition name if it exists, otherwise an empty Optional.
-
lowerBoundType
Returns the type of the lower bound if it exists.- Returns:
- an Optional containing the BoundType of the lower bound if it exists, otherwise an empty Optional.
-
upperBoundType
Returns the type of the upper bound if it exists.- Returns:
- an Optional containing the BoundType of the upper bound if it exists, otherwise an empty Optional.
-
comparator
Returns a comparator for comparing partitions within this range.- Returns:
- a PartitionComparator that can be used to compare partitions.
-