static CompletableFuture<ClickHouseResponseSummary> dump(ClickHouseNode server, String tableOrQuery,
            OutputStream output, ClickHouseCompression compression, ClickHouseFormat format) {
        if (server == null || tableOrQuery == null || output == null) {
            throw new IllegalArgumentException("Non-null server, tableOrQuery, and output are required");
        }

        // in case the protocol is ANY
        final ClickHouseNode theServer = server.probe();

        final String theQuery = tableOrQuery.trim();

        return submit(() -> {
            try (ClickHouseClient client = newInstance(theServer.getProtocol())) {
                ClickHouseRequest<?> request = client.read(theServer).compressServerResponse(compression)
                        .format(format).output(output);
                // FIXME what if the table name is `try me`?
                if (theQuery.indexOf(' ') < 0) {
                    request.table(theQuery);
                } else {
                    request.query(theQuery);
                }

                try (ClickHouseResponse response = request.executeAndWait()) {
                    return response.getSummary();
                }
            } finally {
                try {
                    output.close();
                } catch (IOException e) {
                    // ignore
                }
            }
        });
    }
Dumps a table or query result from server into output stream.

@param server       non-null server to connect to
@param tableOrQuery table name or a select query
@param format       output format to use, null means
                    {@link ClickHouseFormat#TabSeparated}
@param compression  compression algorithm to use, null means
                    {@link ClickHouseCompression#NONE}
@param output       output stream, which will be closed automatically at the
                    end of the call
@return future object to get result
@throws IllegalArgumentException if any of server, tableOrQuery, and output
                                 is null
@throws CompletionException      when error occurred during execution
clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseClient.java