@SuppressWarnings("squid:S2095")
    static ClickHouseInputStream getAsyncResponseInputStream(ClickHouseConfig config, InputStream input,
            Runnable postCloseAction) {
        if (config == null || !config.isAsync()
                || config.getResponseBuffering() == ClickHouseBufferingMode.RESOURCE_EFFICIENT) {
            return getResponseInputStream(config, input, postCloseAction);
        }

        // raw response -> input
        final ClickHousePipedOutputStream stream = ClickHouseDataStreamFactory.getInstance()
                .createPipedOutputStream(config);
        final ClickHouseInputStream wrappedInput;
        // raw response -> decompressed response -> input
        if (config.isResponseCompressed()) { // one more thread for decompression?
            final ClickHousePipedOutputStream decompressedStream = ClickHouseDataStreamFactory.getInstance()
                    .createPipedOutputStream(config);
            wrappedInput = getResponseInputStream(config, decompressedStream.getInputStream(), postCloseAction);
            submit(() -> {
                try (ClickHouseInputStream in = ClickHouseInputStream.of(input, config.getReadBufferSize(),
                        config.getResponseCompressAlgorithm(), config.getResponseCompressLevel(), null);
                        ClickHouseOutputStream out = decompressedStream) {
                    in.pipe(out);
                }
                return null;
            });
        } else {
            wrappedInput = getResponseInputStream(config, input, postCloseAction);
        }
        submit(() -> {
            try (ClickHouseInputStream in = wrappedInput; ClickHouseOutputStream out = stream) {
                in.pipe(out);
            }
            return null;
        });
        return stream.getInputStream();
    }
Gets piped input stream for reading data from response asynchronously. When
{@code config} is {@code null}, {@code config.isAsync()} is {@code false}, or
response buffering mode is
{@link ClickHouseBufferingMode#RESOURCE_EFFICIENT}, this method will be same
as {@link #getResponseInputStream(ClickHouseConfig, InputStream, Runnable)}.

@param config          optional configuration
@param input           non-null input stream
@param postCloseAction custom action will be performed right after closing
                       the input stream
@return wrapped input, or the same input if it's instance of
        {@link ClickHouseInputStream}
clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseClient.java