class CapturingRowConsumer implements RowConsumer {

    private final CompletableFuture<BatchIterator<Row>> batchIterator;
    private final CompletableFuture<?> completionFuture;
    private final boolean requiresScroll;

    public CapturingRowConsumer(boolean requiresScroll, CompletableFuture<?> completionFuture) {
        this.batchIterator = new CompletableFuture<>();
        this.completionFuture = completionFuture;
        this.requiresScroll = requiresScroll;
    }

    @Override
    public void accept(BatchIterator<Row> iterator, @Nullable Throwable failure) {<FILL_FUNCTION_BODY>}

    public CompletableFuture<BatchIterator<Row>> capturedBatchIterator() {
        return batchIterator;
    }

    @Override
    public CompletableFuture<?> completionFuture() {
        return completionFuture;
    }

    @Override
    public boolean requiresScroll() {
        return requiresScroll;
    }

    @Override
    public String toString() {
        return "CapturingRowConsumer{captured=" + batchIterator.isDone() + '}';
    }
}

        if (failure == null) {
            batchIterator.complete(iterator);
        } else {
            batchIterator.completeExceptionally(failure);
        }
    
<no_super_class>