SortingSequence extends BufferingSequence { @Override public long getRowCount() { if (bufferedRows == null) { bufferedRows = initialize(); } return super.rowCount() + rowsWithNullKey.size(); } @SuppressWarnings( {"unchecked"} )  SortingSequence( String workspaceName,
                            NodeSequence delegate,
                            ExtractFromRow extractor,
                            BufferManager bufferMgr,
                            CachedNodeSupplier nodeCache,
                            boolean pack,
                            boolean useHeap,
                            boolean allowDuplicates,
                            NullOrder nullOrder ); @Override long getRowCount(); @Override Batch nextBatch(); @Override void close(); @Override String toString();  }
@Test public void shouldSortSequenceWithDuplicatesOnHeapBuffer() { boolean useHeap = true; boolean pack = false; boolean allowDups = true; ExtractFromRow extractor = RowExtractors.extractPath(0, cache, types); SortingSequence sorted = new SortingSequence(workspaceName(), allNodes(), extractor, bufferMgr, cache, pack, useHeap, allowDups, NullOrder.NULLS_LAST); assertThat(sorted.getRowCount(), is(countRows(allNodes()))); assertSorted(sorted, extractor); }
@Test public void shouldSortSequenceWithoutDuplicatesOnHeapBuffer() { boolean useHeap = true; boolean pack = false; boolean allowDups = false; ExtractFromRow extractor = RowExtractors.extractPath(0, cache, types); SortingSequence sorted = new SortingSequence(workspaceName(), allNodes(), extractor, bufferMgr, cache, pack, useHeap, allowDups, NullOrder.NULLS_LAST); assertThat(sorted.getRowCount(), is(countRows(allNodes()))); assertSorted(sorted, extractor); }
@Test public void shouldSortSequenceWithDuplicatesOffHeapBuffer() { boolean useHeap = false; boolean pack = false; boolean allowDups = true; ExtractFromRow extractor = RowExtractors.extractPath(0, cache, types); SortingSequence sorted = new SortingSequence(workspaceName(), allNodes(), extractor, bufferMgr, cache, pack, useHeap, allowDups, NullOrder.NULLS_LAST); assertThat(sorted.getRowCount(), is(countRows(allNodes()))); assertSorted(sorted, extractor); }
@Test public void shouldSortSequenceWithoutDuplicatesOffHeapBuffer() { boolean useHeap = false; boolean pack = false; boolean allowDups = false; ExtractFromRow extractor = RowExtractors.extractPath(0, cache, types); SortingSequence sorted = new SortingSequence(workspaceName(), allNodes(), extractor, bufferMgr, cache, pack, useHeap, allowDups, NullOrder.NULLS_LAST); assertThat(sorted.getRowCount(), is(countRows(allNodes()))); assertSorted(sorted, extractor); }