Class QueryResponse

java.lang.Object
com.clickhouse.client.api.query.QueryResponse
All Implemented Interfaces:
AutoCloseable

public class QueryResponse extends Object implements AutoCloseable
Response class provides interface to input stream of response data.
It is used to read data from ClickHouse server. It is used to get response metadata like errors, warnings, etc.

This class is for the following user cases:

  • Full read. User does conversion from record to custom object
  • Full read. No conversion to custom object. List of generic records is returned.
  • Iterative read. One record is returned at a time
  • Constructor Details

  • Method Details

    • getInputStream

      public InputStream getInputStream()
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • getFormat

      public ClickHouseFormat getFormat()
    • getMetrics

      public OperationMetrics getMetrics()
      Returns the metrics of this operation.
      Returns:
      metrics of this operation
    • getReadRows

      public long getReadRows()
      Returns:
      number of rows read by server from the storage
    • getReadBytes

      public long getReadBytes()
      Returns:
      number of bytes read by server from the storage
    • getWrittenRows

      public long getWrittenRows()
      Returns:
      number of rows written by server to the storage
    • getWrittenBytes

      public long getWrittenBytes()
      Returns:
      number of bytes written by server to the storage
    • getServerTime

      public long getServerTime()
      Returns:
      elapsed time in nanoseconds
    • getResultRows

      public long getResultRows()
      Returns:
      number of returned rows
    • getTotalRowsToRead

      public long getTotalRowsToRead()
      Returns:
      estimated number of rows to read
    • getQueryId

      public String getQueryId()
      Returns:
      query id of the request
    • getServerDisplayName

      public String getServerDisplayName()
      Returns the value of X-ClickHouse-Server-Display-Name response header.
      Returns:
      server display name or null if not present
    • getResponseHeaders

      public Map<String,String> getResponseHeaders()
      Returns all collected response headers as an unmodifiable map. Only whitelisted ClickHouse headers are included.
      Returns:
      map of header name to header value
    • getTimeZone

      public TimeZone getTimeZone()
    • getSettings

      public QuerySettings getSettings()