Class DataOrdering

    • Field Detail

      • UNSPECIFIED

        public static final DataOrdering UNSPECIFIED
        The default data ordering if not specified.
    • Constructor Detail

      • DataOrdering

        public DataOrdering​(List<SortKey> keys)
        Specify that data is ordered by the given set of keys.
        Parameters:
        keys - specifies field names and ascending vs. descending
      • DataOrdering

        public DataOrdering​(SortKey[] keys)
        Specify that data is ordered by the given set of keys.
        Parameters:
        keys - specifies field names and ascending vs. descending
    • Method Detail

      • isOrdered

        public boolean isOrdered​(SortKey[] desired)
        Returns true if data is ordered by the specified ordering or a prefix of the specified ordering.
        Parameters:
        desired - the desired data ordering
        Returns:
        whether the data is ordered by the desired ordering
      • isOrdered

        public boolean isOrdered​(String[] desired)
        Returns true if data is ordered by the specified ordering or a prefix of the specified ordering. This method ignores ascending vs. descending order. If ascending vs. descending is important use isOrdered(SortKey[]) instead.
        Parameters:
        desired - the desired data ordering
        Returns:
        whether the data is ordered by the desired ordering
      • getAliases

        public AliasSet[] getAliases()
      • getKeys

        public SortKey[] getKeys()
        Returns the keys that the data is sorted by
        Returns:
        the keys the date data is sorted by
      • isUnspecified

        public boolean isUnspecified()
        Returns whether this is the unspecified data ordering. The unspecified data ordering is equivalent to an ordering where there are no sort keys.
        Returns:
        whether this is the unspecified data ordering
      • getPrefixOrdering

        public SortKey[] getPrefixOrdering​(String[] prefix)
        Returns a prefix of the current ordering, merged with sort direction information. This is useful for operators that require data be sorted by a specific set of keys but have no specific requirements regarding sort direction. Those operators will first need to test whether data is ordered as desired by calling isOrdered(String[]). If data is ordered, they will then call this method to determine specific directional information.
        Parameters:
        prefix - must be a prefix of the data ordering
        Returns:
        a prefix of the current ordering.
        Throws:
        IllegalArgumentException - if the data is not ordered by the given prefix
      • remap

        public DataOrdering remap​(FieldRemapping mapping)
        Applies the given field remapping to this ordering, changing names as required. If any sort keys refer to columns that are dropped as part of the rename, the result ordering will be a prefix of the original. If all sort keys refer to columns that are dropped via the rename, the result will be the UNSPECIFIED ordering.
        Parameters:
        mapping - the field remapping.
        Returns:
        this distribution, remapped to the new names.