class SingleBucketBuilder implements RowConsumer, CompletionListenable<StreamBucket> {

    private final Streamer<?>[] streamers;
    private RamAccounting ramAccounting;
    private final CompletableFuture<StreamBucket> bucketFuture = new CompletableFuture<>();

    public SingleBucketBuilder(Streamer<?>[] streamers, RamAccounting ramAccounting) {
        this.streamers = streamers;
        this.ramAccounting = ramAccounting;
    }

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

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

        if (failure == null) {
            StreamBucketCollector streamBucketCollector = new StreamBucketCollector(streamers, ramAccounting);
            BatchIterators.collect(iterator, streamBucketCollector.supplier().get(), streamBucketCollector, bucketFuture);
        } else {
            if (iterator != null) {
                iterator.close();
            }
            bucketFuture.completeExceptionally(failure);
        }
    
<no_super_class>