public static CompletableFuture<Void> chainWriteDataBlock(DataBlockWriter dataBlockWriter,
        List<StreamDataBlock> streamDataBlocks, ExecutorService executorService) {
        CompletableFuture<Void> cf = null;
        for (StreamDataBlock streamDataBlock : streamDataBlocks) {
            if (cf == null) {
                cf = streamDataBlock.getDataCf().thenAcceptAsync(data -> dataBlockWriter.write(streamDataBlock), executorService);
            } else {
                cf = cf.thenCompose(nil -> streamDataBlock.getDataCf().thenAcceptAsync(data -> dataBlockWriter.write(streamDataBlock), executorService));
            }
        }
        return cf;
    }
Group stream data blocks by certain conditions.

@param streamDataBlocks stream data blocks to be grouped
@param predicate        the predicate to check whether a stream data block should be grouped with the previous one
@return grouped stream data blocks
s3stream/src/main/java/com/automq/stream/s3/compact/utils/CompactionUtils.java