Interface ClickHouseResponse

All Superinterfaces:
AutoCloseable, Serializable
All Known Implementing Classes:
ClickHouseSimpleResponse, ClickHouseStreamResponse

@Deprecated public interface ClickHouseResponse extends AutoCloseable, Serializable
Deprecated.
This encapsulates a server reponse. Depending on concrete implementation, it could be either an in-memory list or a wrapped input stream with ClickHouseDataProcessor attached for deserialization. To get data returned from server, depending on actual needs, you have 3 options:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ClickHouseResponse
    Deprecated.
    Empty response that can never be closed.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
     
    Deprecated.
    Gets the first record only.
    default <T> T
    firstRecord(Class<T> objClass)
    Deprecated.
    Gets the first record as mapped object.
    Deprecated.
    Gets list of columns.
    Deprecated.
    Gets input stream of the response.
    Deprecated.
    Gets summary of this response.
    default TimeZone
    Deprecated.
    Returns a server timezone if it is returned by server in a header X-ClickHouse-Timezone or other way.
    boolean
    Deprecated.
    Checks whether the response has been closed or not.
    default void
    pipe(OutputStream output, int bufferSize)
    Deprecated.
    Pipes the contents of this response into the given output stream.
    Deprecated.
    Returns an iterable collection of records which can be walked through in a foreach loop.
    <T> Iterable<T>
    records(Class<T> objClass)
    Deprecated.
    Returns an iterable collection of mapped objects which can be walked through in a foreach loop.
    Deprecated.
    Gets stream of records to process.
    default <T> Stream<T>
    stream(Class<T> objClass)
    Deprecated.
    Gets stream of mapped objects to process.
  • Field Details

    • EMPTY

      static final ClickHouseResponse EMPTY
      Deprecated.
      Empty response that can never be closed.
  • Method Details

    • getColumns

      List<ClickHouseColumn> getColumns()
      Deprecated.
      Gets list of columns.
      Returns:
      non-null list of column
    • getSummary

      Deprecated.
      Gets summary of this response. Keep in mind that the summary may change over time until response is closed.
      Returns:
      non-null summary of this response
    • getInputStream

      ClickHouseInputStream getInputStream()
      Deprecated.
      Gets input stream of the response. In general, this is the most memory-efficient way for streaming data from server to client. However, this also means additional work is required for deserialization, especially when using a binary format.
      Returns:
      non-null input stream for getting raw data returned from server
    • getTimeZone

      default TimeZone getTimeZone()
      Deprecated.
      Returns a server timezone if it is returned by server in a header X-ClickHouse-Timezone or other way. If not, it returns null
      Returns:
      server timezone from server response or null
    • firstRecord

      default ClickHouseRecord firstRecord()
      Deprecated.
      Gets the first record only. Please use records() instead if you need to access the rest of records.
      Returns:
      the first record
      Throws:
      NoSuchElementException - when there's no record at all
      UncheckedIOException - when failed to read data(e.g. deserialization)
    • firstRecord

      default <T> T firstRecord(Class<T> objClass)
      Deprecated.
      Gets the first record as mapped object. Please use records(Class) instead if you need to access the rest of records.
      Type Parameters:
      T - type of the mapped object
      Parameters:
      objClass - non-null class of the mapped object
      Returns:
      mapped object of the first record
      Throws:
      NoSuchElementException - when there's no record at all
      UncheckedIOException - when failed to read data(e.g. deserialization)
    • records

      Deprecated.
      Returns an iterable collection of records which can be walked through in a foreach loop. Please pay attention that: 1) UncheckedIOException might be thrown when iterating through the collection; and 2) it's not supposed to be called for more than once.
      Returns:
      non-null iterable collection
      Throws:
      UncheckedIOException - when failed to read data(e.g. deserialization)
    • records

      <T> Iterable<T> records(Class<T> objClass)
      Deprecated.
      Returns an iterable collection of mapped objects which can be walked through in a foreach loop. When objClass is null or ClickHouseRecord, it's same as calling records().
      Type Parameters:
      T - type of the mapped object
      Parameters:
      objClass - non-null class of the mapped object
      Returns:
      non-null iterable collection
      Throws:
      UncheckedIOException - when failed to read data(e.g. deserialization)
    • pipe

      default void pipe(OutputStream output, int bufferSize) throws IOException
      Deprecated.
      Pipes the contents of this response into the given output stream. Keep in mind that it's caller's responsibility to flush and close the output stream.
      Parameters:
      output - non-null output stream, which will remain open
      bufferSize - buffer size, 0 or negative value will be treated as ClickHouseClientOption.BUFFER_SIZE
      Throws:
      IOException - when error occurred reading or writing data
    • stream

      default Stream<ClickHouseRecord> stream()
      Deprecated.
      Gets stream of records to process.
      Returns:
      stream of records
    • stream

      default <T> Stream<T> stream(Class<T> objClass)
      Deprecated.
      Gets stream of mapped objects to process.
      Returns:
      stream of mapped objects
    • close

      void close()
      Deprecated.
      Specified by:
      close in interface AutoCloseable
    • isClosed

      boolean isClosed()
      Deprecated.
      Checks whether the response has been closed or not.
      Returns:
      true if the response has been closed; false otherwise