@Override
    public int compareTo(HsSubpartitionFileReader that) {
        checkArgument(that instanceof HsSubpartitionFileReaderImpl);
        return Long.compare(
                getNextOffsetToLoad(), ((HsSubpartitionFileReaderImpl) that).getNextOffsetToLoad());
    }
@Test
    void testCompareTo(@TempDir Path tempPath) throws Exception {
        diskIndex = createDataIndex(2, tempPath.resolve(".index"));
        TestingSubpartitionConsumerInternalOperation viewNotifier1 =
                new TestingSubpartitionConsumerInternalOperation();
        TestingSubpartitionConsumerInternalOperation viewNotifier2 =
                new TestingSubpartitionConsumerInternalOperation();
        HsSubpartitionFileReaderImpl fileReader1 = createSubpartitionFileReader(0, viewNotifier1);
        HsSubpartitionFileReaderImpl fileReader2 = createSubpartitionFileReader(1, viewNotifier2);
        assertThat(fileReader1).isEqualByComparingTo(fileReader2);

        // buffers in file: (0-0, 0-1, 1-0, 0-2)
        writeDataToFile(0, 0, 2);
        writeDataToFile(1, 0, 1);
        writeDataToFile(0, 2, 1);
        // fileReader1 -> (0-0) fileReader2 -> (1-0)
        assertThat(fileReader1).isLessThan(fileReader2);

        viewNotifier1.advanceConsumptionProgress();
        fileReader1.prepareForScheduling();
        // fileReader1 -> (0-1) fileReader2 -> (1-0)
        assertThat(fileReader1).isLessThan(fileReader2);

        viewNotifier1.advanceConsumptionProgress();
        fileReader1.prepareForScheduling();
        // fileReader1 -> (0-2) fileReader2 -> (1-0)
        assertThat(fileReader1).isGreaterThan(fileReader2);
    }