Class SortedRangeSet

  • All Implemented Interfaces:
    ValueSet, AutoCloseable

    public class SortedRangeSet
    extends Object
    implements ValueSet
    A set containing values that are represented as ranges that are sorted by their lower bound. For example: col between 10 and 30, or col between 40 and 60, or col between 90 and 1000.
    See Also:
    ValueSet
    • Method Detail

      • none

        public static SortedRangeSet none​(org.apache.arrow.vector.types.pojo.ArrowType type)
      • onlyNull

        public static SortedRangeSet onlyNull​(org.apache.arrow.vector.types.pojo.ArrowType type)
      • of

        public static SortedRangeSet of​(Range first,
                                        Range... rest)
        Provided Ranges are unioned together to form the SortedRangeSet
      • of

        public static SortedRangeSet of​(boolean nullAllowed,
                                        Range first,
                                        Range... rest)
        Provided Ranges are unioned together to form the SortedRangeSet
      • copyOf

        public static SortedRangeSet copyOf​(org.apache.arrow.vector.types.pojo.ArrowType type,
                                            List<Range> ranges,
                                            boolean nullAllowed)
      • isNullAllowed

        public boolean isNullAllowed()
        Conveys if nulls should be allowed.
        Specified by:
        isNullAllowed in interface ValueSet
        Returns:
        True if NULLs satisfy this constraint, false otherwise.
        See Also:
        ValueSet
      • getType

        public org.apache.arrow.vector.types.pojo.ArrowType getType()
        The Arrow Type of the field this constraint applies to.
        Specified by:
        getType in interface ValueSet
        Returns:
        The ArrowType of the field this ValueSet applies to.
        See Also:
        ValueSet
      • getOrderedRanges

        public List<Range> getOrderedRanges()
      • getRangeCount

        public int getRangeCount()
      • isNone

        public boolean isNone()
        Conveys if no value can satisfy this ValueSet.
        Specified by:
        isNone in interface ValueSet
        Returns:
        True if no value can satisfy this ValueSet, false otherwise.
        See Also:
        ValueSet
      • isAll

        public boolean isAll()
        Conveys if any value can satisfy this ValueSet.
        Specified by:
        isAll in interface ValueSet
        Returns:
        True if any value can satisfy this ValueSet, false otherwise.
        See Also:
        ValueSet
      • isSingleValue

        public boolean isSingleValue()
        Conveys if this ValueSet contains a single value.
        Specified by:
        isSingleValue in interface ValueSet
        Returns:
        True if this ValueSet contains only a single value.
      • getSingleValue

        public Object getSingleValue()
        Attempts to return the single value contained in this ValueSet.
        Specified by:
        getSingleValue in interface ValueSet
        Returns:
        The single value contained in this ValueSet.
        Throws:
        IllegalStateException - if this ValueSet does not contain exactly 1 value.
      • containsValue

        public boolean containsValue​(Marker marker)
        Used to test if the supplied value (in the form of a Marker) is contained in this ValueSet.
        Specified by:
        containsValue in interface ValueSet
        Parameters:
        marker - The value to test in the form of a Marker.
        Returns:
        True if the value is contained in the ValueSet, False otherwise.
      • containsValue

        public boolean containsValue​(Object value)
        Used to test if the supplied value (in the form of a Marker) is contained in this ValueSet.
        Specified by:
        containsValue in interface ValueSet
        Parameters:
        value - The value to test in the form of a Marker.
        Returns:
        True if the value is contained in the ValueSet, False otherwise.
      • getSpan

        public Range getSpan()
        Gets a summary of the lowest lower bound and the highest upper bound that represents this ValueSet, keep in mind that this summary may include more than the actual SortedRangeSet (e.g. col between 10 and 40 or col between 50 and 80 would yield a span of between 10 and 80).
        Returns:
        A Span which encompasses the lower bound and upper bound of the ValueSet.
      • getRanges

        public Ranges getRanges()
        Provides access to the Ranges that comprise this ValueSet.
        Specified by:
        getRanges in interface ValueSet
        Returns:
        The Ranges in the ValueSet.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • newBuilder

        public static SortedRangeSet.Builder newBuilder​(org.apache.arrow.vector.types.pojo.ArrowType type,
                                                        boolean nullAllowed)