Class Sort


  • public final class Sort
    extends Object
    On-disk sorting of byte arrays. Each byte array (entry) is a composed of the following fields:
    • (two bytes) length of the following byte array,
    • exactly the above count of bytes for the sequence to be sorted.
    See Also:
    sort(File, File)
    WARNING: This API is experimental and might change in incompatible ways in the next release.
    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
    • Field Detail

      • MIN_BUFFER_SIZE_MB

        public static final long MIN_BUFFER_SIZE_MB
        Minimum recommended buffer size for sorting.
        See Also:
        Constant Field Values
      • ABSOLUTE_MIN_SORT_BUFFER_SIZE

        public static final long ABSOLUTE_MIN_SORT_BUFFER_SIZE
        Absolute minimum required buffer size for sorting.
        See Also:
        Constant Field Values
      • MAX_TEMPFILES

        public static final int MAX_TEMPFILES
        Maximum number of temporary files before doing an intermediate merge.
        See Also:
        Constant Field Values
      • DEFAULT_COMPARATOR

        public static final Comparator<org.apache.lucene.util.BytesRef> DEFAULT_COMPARATOR
    • Method Detail

      • sort

        public Sort.SortInfo sort​(File input,
                                  File output)
                           throws IOException
        Sort input to output, explicit hint for the buffer size. The amount of allocated memory may deviate from the hint (may be smaller or larger).
        Throws:
        IOException
      • defaultTempDir

        public static File defaultTempDir()
                                   throws IOException
        Returns the default temporary directory. By default, java.io.tmpdir. If not accessible or not available, an IOException is thrown
        Throws:
        IOException
      • sortPartition

        protected File sortPartition​(int len)
                              throws IOException
        Sort a single partition in-memory.
        Throws:
        IOException
      • getComparator

        public Comparator<org.apache.lucene.util.BytesRef> getComparator()