Interface ClickHouseBinaryFormatReader

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
AbstractBinaryFormatReader, NativeFormatReader, RowBinaryFormatReader, RowBinaryWithNamesAndTypesFormatReader, RowBinaryWithNamesFormatReader

public interface ClickHouseBinaryFormatReader extends AutoCloseable
  • Method Details

    • readValue

      <T> T readValue(int colIndex)
      Reads a single value from the stream.
      Type Parameters:
      T -
      Returns:
    • readValue

      <T> T readValue(String colName)
      Reads a row to an array of objects.
      Type Parameters:
      T -
      Parameters:
      colName -
      Returns:
    • hasValue

      boolean hasValue(String colName)
    • hasValue

      boolean hasValue(int colIndex)
    • hasNext

      boolean hasNext()
      Checks if there are more rows to read.
      Returns:
    • next

      Map<String,Object> next()
      Moves cursor to the next row. Must be called before reading the first row. Returns reference to an internal record representation. It means that next call to the method will affect value in returned Map. This is done for memory usage optimization. Method is intended to be used only by the client not an application.
      Returns:
      reference to a map filled with column values or null if no more records are available
    • getString

      String getString(String colName)
      Reads column with name `colName` as a string.
      Parameters:
      colName - - column name
      Returns:
    • getByte

      byte getByte(String colName)
      Reads column with name `colName` as a byte.
      Parameters:
      colName - - column name
      Returns:
    • getShort

      short getShort(String colName)
      Reads column with name `colName` as a short.
      Parameters:
      colName - - column name
      Returns:
    • getInteger

      int getInteger(String colName)
      Reads column with name `colName` as an integer.
      Parameters:
      colName - - column name
      Returns:
    • getLong

      long getLong(String colName)
      Reads column with name `colName` as a long.
      Parameters:
      colName - - column name
      Returns:
    • getFloat

      float getFloat(String colName)
      Reads column with name `colName` as a float. Warning: this method may lose precision for float values.
      Parameters:
      colName -
      Returns:
    • getDouble

      double getDouble(String colName)
      Reads column with name `colName` as a double. Warning: this method may lose precision for double values.
      Parameters:
      colName -
      Returns:
    • getBoolean

      boolean getBoolean(String colName)
      Reads column with name `colName` as a boolean.
      Parameters:
      colName -
      Returns:
    • getBigInteger

      BigInteger getBigInteger(String colName)
      Reads column with name `colName` as a BigInteger.
      Parameters:
      colName -
      Returns:
    • getBigDecimal

      BigDecimal getBigDecimal(String colName)
      Reads column with name `colName` as a BigDecimal.
      Parameters:
      colName -
      Returns:
    • getInstant

      Instant getInstant(String colName)
      Returns the value of the specified column as an Instant. Timezone is derived from the column definition. If no timezone is specified in the column definition then UTC will be used. If column value is Date or Date32 it will return an Instant with time set to 00:00:00. If column value is DateTime or DateTime32 it will return an Instant with the time part.
      Parameters:
      colName -
      Returns:
    • getZonedDateTime

      ZonedDateTime getZonedDateTime(String colName)
      Returns the value of the specified column as a ZonedDateTime. Timezone is derived from the column definition. If no timezone is specified in the column definition then UTC will be used. If column value is Date or Date32 it will return a ZonedDateTime with time set to 00:00:00. If column value is DateTime or DateTime32 it will return a ZonedDateTime with the time part.
      Parameters:
      colName -
      Returns:
    • getDuration

      Duration getDuration(String colName)
      Returns the value of the specified column as a Duration. If a stored value is bigger than Long.MAX_VALUE then exception will be thrown. In such case use asBigInteger() method. If value of IntervalQuarter then Duration will be in the unit of Months.
      Parameters:
      colName -
      Returns:
      Duration in the unit of column type.
    • getInet4Address

      Inet4Address getInet4Address(String colName)
      Returns the value of the specified column as an Inet4Address.
      Parameters:
      colName -
      Returns:
    • getInet6Address

      Inet6Address getInet6Address(String colName)
      Returns the value of the specified column as an Inet6Address.
      Parameters:
      colName -
      Returns:
    • getUUID

      UUID getUUID(String colName)
      Returns the value of the specified column as a UUID.
      Parameters:
      colName -
      Returns:
    • getGeoPoint

      ClickHouseGeoPointValue getGeoPoint(String colName)
      Returns the value of the specified column as a ClickHouseGeoPointValue.
      Parameters:
      colName -
      Returns:
    • getGeoRing

      ClickHouseGeoRingValue getGeoRing(String colName)
      Returns the value of the specified column as a ClickHouseGeoRingValue.
      Parameters:
      colName -
      Returns:
    • getGeoPolygon

      ClickHouseGeoPolygonValue getGeoPolygon(String colName)
      Returns the value of the specified column as a ClickHouseGeoPolygonValue.
      Parameters:
      colName -
      Returns:
    • getGeoMultiPolygon

      ClickHouseGeoMultiPolygonValue getGeoMultiPolygon(String colName)
      Returns the value of the specified column as a ClickHouseGeoMultiPolygonValue.
      Parameters:
      colName -
      Returns:
    • getList

      <T> List<T> getList(String colName)
      Parameters:
      colName - - column name
      Returns:
      list of values, or null if the value is null
      See Also:
    • getByteArray

      byte[] getByteArray(String colName)
      Parameters:
      colName - - column name
      Returns:
      array of bytes, or null if the value is null
      See Also:
    • getIntArray

      int[] getIntArray(String colName)
      Parameters:
      colName - - column name
      Returns:
      array of int values, or null if the value is null
      See Also:
    • getLongArray

      long[] getLongArray(String colName)
      Parameters:
      colName - - column name
      Returns:
      array of long values, or null if the value is null
      See Also:
    • getFloatArray

      float[] getFloatArray(String colName)
      Parameters:
      colName - - column name
      Returns:
      array of float values, or null if the value is null
      See Also:
    • getDoubleArray

      double[] getDoubleArray(String colName)
      Parameters:
      colName - - column name
      Returns:
      array of double values, or null if the value is null
      See Also:
    • getBooleanArray

      boolean[] getBooleanArray(String colName)
      Parameters:
      colName - - column name
      Returns:
      array of boolean values, or null if the value is null
      See Also:
    • getShortArray

      short[] getShortArray(String colName)
      Parameters:
      colName - - column name
      Returns:
      array of short values, or null if the value is null
      See Also:
    • getStringArray

      String[] getStringArray(String colName)
      Parameters:
      colName - - column name
      Returns:
      array of string values, or null if the value is null
      See Also:
    • getObjectArray

      Object[] getObjectArray(String colName)
      Parameters:
      colName - - column name
      Returns:
      array of objects, or null if the value is null
      See Also:
    • getString

      String getString(int index)
      Reads column with name `colName` as a string.
      Parameters:
      index -
      Returns:
    • getByte

      byte getByte(int index)
      Reads column with name `colName` as a byte.
      Parameters:
      index -
      Returns:
    • getShort

      short getShort(int index)
      Reads column with name `colName` as a short.
      Parameters:
      index -
      Returns:
    • getInteger

      int getInteger(int index)
      Reads column with name `colName` as an integer.
      Parameters:
      index -
      Returns:
    • getLong

      long getLong(int index)
      Reads column with name `colName` as a long.
      Parameters:
      index -
      Returns:
    • getFloat

      float getFloat(int index)
      Reads column with name `colName` as a float. Warning: this method may lose precision for float values.
      Parameters:
      index -
      Returns:
    • getDouble

      double getDouble(int index)
      Reads column with name `colName` as a double. Warning: this method may lose precision for double values.
      Parameters:
      index -
      Returns:
    • getBoolean

      boolean getBoolean(int index)
      Reads column with name `colName` as a boolean.
      Parameters:
      index -
      Returns:
    • getBigInteger

      BigInteger getBigInteger(int index)
      Reads column with name `colName` as a BigInteger.
      Parameters:
      index -
      Returns:
    • getBigDecimal

      BigDecimal getBigDecimal(int index)
      Reads column with name `colName` as a BigDecimal.
      Parameters:
      index -
      Returns:
    • getInstant

      Instant getInstant(int index)
      Returns the value of the specified column as an Instant. Timezone is derived from the column definition. If no timezone is specified in the column definition then UTC will be used. If column value is Date or Date32 it will return an Instant with time set to 00:00:00. If column value is DateTime or DateTime32 it will return an Instant with the time part.
      Parameters:
      index -
      Returns:
    • getZonedDateTime

      ZonedDateTime getZonedDateTime(int index)
      Returns the value of the specified column as a ZonedDateTime. Timezone is derived from the column definition. If no timezone is specified in the column definition then UTC will be used. If column value is Date or Date32 it will return a ZonedDateTime with time set to 00:00:00. If column value is DateTime or DateTime32 it will return a ZonedDateTime with the time part.
      Parameters:
      index -
      Returns:
    • getDuration

      Duration getDuration(int index)
      Returns the value of the specified column as a Duration. If a stored value is bigger than Long.MAX_VALUE then exception will be thrown. In such case use asBigInteger() method. If value of IntervalQuarter then Duration will be in the unit of Months.
      Parameters:
      index -
      Returns:
      Duration in the unit of column type.
    • getInet4Address

      Inet4Address getInet4Address(int index)
      Returns the value of the specified column as an Inet4Address.
      Parameters:
      index -
      Returns:
    • getInet6Address

      Inet6Address getInet6Address(int index)
      Returns the value of the specified column as an Inet6Address.
      Parameters:
      index -
      Returns:
    • getUUID

      UUID getUUID(int index)
      Returns the value of the specified column as a UUID.
      Parameters:
      index -
      Returns:
    • getGeoPoint

      ClickHouseGeoPointValue getGeoPoint(int index)
      Returns the value of the specified column as a ClickHouseGeoPointValue.
      Parameters:
      index -
      Returns:
    • getGeoRing

      ClickHouseGeoRingValue getGeoRing(int index)
      Returns the value of the specified column as a ClickHouseGeoRingValue.
      Parameters:
      index -
      Returns:
    • getGeoPolygon

      ClickHouseGeoPolygonValue getGeoPolygon(int index)
      Returns the value of the specified column as a ClickHouseGeoPolygonValue.
      Parameters:
      index -
      Returns:
    • getGeoMultiPolygon

      ClickHouseGeoMultiPolygonValue getGeoMultiPolygon(int index)
      Returns the value of the specified column as a ClickHouseGeoMultiPolygonValue.
      Parameters:
      index -
      Returns:
    • getList

      <T> List<T> getList(int index)
      Returns the value of the specified column as a List. Suitable for reading Array columns of any type.

      For nested arrays (e.g. Array(Array(Int64))), returns a List<List<Long>>. For nullable arrays (e.g. Array(Nullable(Int32))), list elements may be null.

      Parameters:
      index - - column index (1-based)
      Returns:
      list of values, or null if the value is null
      Throws:
      ClientException - if the column is not an array type
    • getByteArray

      byte[] getByteArray(int index)
      Returns the value of the specified column as a byte[]. Suitable for 1D Array columns only.
      Parameters:
      index - - column index (1-based)
      Returns:
      array of bytes, or null if the value is null
      Throws:
      ClientException - if the value cannot be converted to a byte array
    • getIntArray

      int[] getIntArray(int index)
      Returns the value of the specified column as an int[]. Suitable for 1D Array columns only.
      Parameters:
      index - - column index (1-based)
      Returns:
      array of int values, or null if the value is null
      Throws:
      ClientException - if the value cannot be converted to an int array
    • getLongArray

      long[] getLongArray(int index)
      Returns the value of the specified column as a long[]. Suitable for 1D Array columns only.
      Parameters:
      index - - column index (1-based)
      Returns:
      array of long values, or null if the value is null
      Throws:
      ClientException - if the value cannot be converted to a long array
    • getFloatArray

      float[] getFloatArray(int index)
      Returns the value of the specified column as a float[]. Suitable for 1D Array columns only.
      Parameters:
      index - - column index (1-based)
      Returns:
      array of float values, or null if the value is null
      Throws:
      ClientException - if the value cannot be converted to a float array
    • getDoubleArray

      double[] getDoubleArray(int index)
      Returns the value of the specified column as a double[]. Suitable for 1D Array columns only.
      Parameters:
      index - - column index (1-based)
      Returns:
      array of double values, or null if the value is null
      Throws:
      ClientException - if the value cannot be converted to a double array
    • getBooleanArray

      boolean[] getBooleanArray(int index)
      Returns the value of the specified column as a boolean[]. Suitable for 1D Array columns only.
      Parameters:
      index - - column index (1-based)
      Returns:
      array of boolean values, or null if the value is null
      Throws:
      ClientException - if the value cannot be converted to a boolean array
    • getShortArray

      short[] getShortArray(int index)
      Returns the value of the specified column as a short[]. Suitable for 1D Array columns only.
      Parameters:
      index - - column index (1-based)
      Returns:
      array of short values, or null if the value is null
      Throws:
      ClientException - if the value cannot be converted to a short array
    • getStringArray

      String[] getStringArray(int index)
      Returns the value of the specified column as a String[]. Suitable for 1D Array columns only. Cannot be used for none string element types.
      Parameters:
      index - - column index (1-based)
      Returns:
      array of string values, or null if the value is null
      Throws:
      ClientException - if the column is not an array type
    • getObjectArray

      Object[] getObjectArray(int index)
      Returns the value of the specified column as an Object[]. Suitable for multidimensional Array columns. Nested arrays are recursively converted to Object[]. Note: result is not cached so avoid repetitive calls on same column.
      Parameters:
      index - - column index (1-based)
      Returns:
      array of objects, or null if the value is null
      Throws:
      ClientException - if the column is not an array type
    • getTuple

      Object[] getTuple(int index)
    • getTuple

      Object[] getTuple(String colName)
    • getEnum8

      byte getEnum8(String colName)
    • getEnum8

      byte getEnum8(int index)
    • getEnum16

      short getEnum16(String colName)
    • getEnum16

      short getEnum16(int index)
    • getLocalDate

      LocalDate getLocalDate(String colName)
    • getLocalDate

      LocalDate getLocalDate(int index)
    • getLocalTime

      LocalTime getLocalTime(String colName)
    • getLocalTime

      LocalTime getLocalTime(int index)
    • getLocalDateTime

      LocalDateTime getLocalDateTime(String colName)
    • getLocalDateTime

      LocalDateTime getLocalDateTime(int index)
    • getOffsetDateTime

      OffsetDateTime getOffsetDateTime(String colName)
    • getOffsetDateTime

      OffsetDateTime getOffsetDateTime(int index)
    • getSchema

      TableSchema getSchema()
    • getClickHouseBitmap

      ClickHouseBitmap getClickHouseBitmap(String colName)
    • getClickHouseBitmap

      ClickHouseBitmap getClickHouseBitmap(int index)
    • getTemporalAmount

      TemporalAmount getTemporalAmount(int index)
    • getTemporalAmount

      TemporalAmount getTemporalAmount(String colName)