Class PartitionRange

java.lang.Object
org.apache.gravitino.stats.PartitionRange

public class PartitionRange extends Object
PartitionRange represents a range of partitions defined by lower and upper partition names.
  • 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

      public Optional<String> 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

      public Optional<String> 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

      public Optional<PartitionRange.BoundType> 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

      public Optional<PartitionRange.BoundType> 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

      public SortOrder comparator()
      Returns a comparator for comparing partitions within this range.
      Returns:
      a PartitionComparator that can be used to compare partitions.