Class AbstractBinaryFormatReader
java.lang.Object
com.clickhouse.client.api.data_formats.internal.AbstractBinaryFormatReader
- All Implemented Interfaces:
ClickHouseBinaryFormatReader
- Direct Known Subclasses:
NativeFormatReader,RowBinaryFormatReader,RowBinaryWithNamesAndTypesFormatReader,RowBinaryWithNamesFormatReader
public abstract class AbstractBinaryFormatReader
extends Object
implements ClickHouseBinaryFormatReader
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractBinaryFormatReader(InputStream inputStream, QuerySettings querySettings, TableSchema schema) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidgetBigDecimal(int index) Reads column with name `colName` as a BigDecimal.getBigDecimal(String colName) Reads column with name `colName` as a BigDecimal.getBigInteger(int index) Reads column with name `colName` as a BigInteger.getBigInteger(String colName) Reads column with name `colName` as a BigInteger.booleangetBoolean(int index) Reads column with name `colName` as a boolean.booleangetBoolean(String colName) Reads column with name `colName` as a boolean.bytegetByte(int index) Reads column with name `colName` as a byte.byteReads column with name `colName` as a byte.byte[]getByteArray(int index) Reads column with name `colName` as a string.byte[]getByteArray(String colName) Reads column with name `colName` as a string.doublegetDouble(int index) Reads column with name `colName` as a double.doubleReads column with name `colName` as a double.double[]getDoubleArray(int index) Reads column with name `colName` as a string.double[]getDoubleArray(String colName) Reads column with name `colName` as a string.getDuration(int index) Returns the value of the specified column as a Duration.getDuration(String colName) Returns the value of the specified column as a Duration.shortgetEnum16(int index) shortbytegetEnum8(int index) bytefloatgetFloat(int index) Reads column with name `colName` as a float.floatReads column with name `colName` as a float.float[]getFloatArray(int index) Reads column with name `colName` as a string.float[]getFloatArray(String colName) Reads column with name `colName` as a string.com.clickhouse.data.value.ClickHouseGeoMultiPolygonValuegetGeoMultiPolygon(int index) Returns the value of the specified column as a ClickHouseGeoMultiPolygonValue.com.clickhouse.data.value.ClickHouseGeoMultiPolygonValuegetGeoMultiPolygon(String colName) Returns the value of the specified column as a ClickHouseGeoMultiPolygonValue.com.clickhouse.data.value.ClickHouseGeoPointValuegetGeoPoint(int index) Returns the value of the specified column as a ClickHouseGeoPointValue.com.clickhouse.data.value.ClickHouseGeoPointValuegetGeoPoint(String colName) Returns the value of the specified column as a ClickHouseGeoPointValue.com.clickhouse.data.value.ClickHouseGeoPolygonValuegetGeoPolygon(int index) Returns the value of the specified column as a ClickHouseGeoPolygonValue.com.clickhouse.data.value.ClickHouseGeoPolygonValuegetGeoPolygon(String colName) Returns the value of the specified column as a ClickHouseGeoPolygonValue.com.clickhouse.data.value.ClickHouseGeoRingValuegetGeoRing(int index) Returns the value of the specified column as a ClickHouseGeoRingValue.com.clickhouse.data.value.ClickHouseGeoRingValuegetGeoRing(String colName) Returns the value of the specified column as a ClickHouseGeoRingValue.getInet4Address(int index) Returns the value of the specified column as an Inet4Address.getInet4Address(String colName) Returns the value of the specified column as an Inet4Address.getInet6Address(int index) Returns the value of the specified column as an Inet6Address.getInet6Address(String colName) Returns the value of the specified column as an Inet6Address.getInstant(int index) Returns the value of the specified column as an Instant.getInstant(String colName) Returns the value of the specified column as an Instant.int[]getIntArray(int index) Reads column with name `colName` as a string.int[]getIntArray(String colName) Reads column with name `colName` as a string.intgetInteger(int index) Reads column with name `colName` as an integer.intgetInteger(String colName) Reads column with name `colName` as an integer.<T> List<T>getList(int index) Reads column with name `colName` as a string.<T> List<T>Reads column with name `colName` as a string.getLocalDate(int index) getLocalDate(String colName) getLocalDateTime(int index) getLocalDateTime(String colName) longgetLong(int index) Reads column with name `colName` as a long.longReads column with name `colName` as a long.long[]getLongArray(int index) Reads column with name `colName` as a string.long[]getLongArray(String colName) Reads column with name `colName` as a string.shortgetShort(int index) Reads column with name `colName` as a short.shortReads column with name `colName` as a short.getString(int index) Reads column with name `colName` as a string.Reads column with name `colName` as a string.Object[]getTuple(int index) Object[]getUUID(int index) Returns the value of the specified column as a UUID.Returns the value of the specified column as a UUID.getZonedDateTime(int index) Returns the value of the specified column as a ZonedDateTime.getZonedDateTime(String colName) Returns the value of the specified column as a ZonedDateTime.booleanhasNext()Checks if there are more rows to read.booleanhasValue(int colIndex) booleannext()Moves cursor to the next row.protected voidprotected booleanreadRecord(Map<String, Object> record) <T> TreadValue(int colIndex) Reads a single value from the stream.<T> TReads a row to an array of objects.protected voidsetSchema(TableSchema schema)
-
Field Details
-
input
-
settings
-
binaryStreamReader
-
currentRecord
-
nextRecord
-
-
Constructor Details
-
AbstractBinaryFormatReader
protected AbstractBinaryFormatReader(InputStream inputStream, QuerySettings querySettings, TableSchema schema)
-
-
Method Details
-
readRecord
- Throws:
IOException
-
readValue
public <T> T readValue(int colIndex) Description copied from interface:ClickHouseBinaryFormatReaderReads a single value from the stream.- Specified by:
readValuein interfaceClickHouseBinaryFormatReader- Returns:
-
readValue
Description copied from interface:ClickHouseBinaryFormatReaderReads a row to an array of objects.- Specified by:
readValuein interfaceClickHouseBinaryFormatReader- Returns:
-
hasNext
public boolean hasNext()Description copied from interface:ClickHouseBinaryFormatReaderChecks if there are more rows to read.- Specified by:
hasNextin interfaceClickHouseBinaryFormatReader- Returns:
-
readNextRecord
protected void readNextRecord() -
next
Description copied from interface:ClickHouseBinaryFormatReaderMoves cursor to the next row. Must be called before reading the first row.- Specified by:
nextin interfaceClickHouseBinaryFormatReader- Returns:
- map filled with column values or null if no more records are available
-
endReached
protected void endReached() -
setSchema
-
getSchema
- Specified by:
getSchemain interfaceClickHouseBinaryFormatReader
-
getString
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getStringin interfaceClickHouseBinaryFormatReader- Parameters:
colName- - column name- Returns:
-
getString
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getStringin interfaceClickHouseBinaryFormatReader- Returns:
-
getByte
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a byte.- Specified by:
getBytein interfaceClickHouseBinaryFormatReader- Parameters:
colName- - column name- Returns:
-
getShort
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a short.- Specified by:
getShortin interfaceClickHouseBinaryFormatReader- Parameters:
colName- - column name- Returns:
-
getInteger
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as an integer.- Specified by:
getIntegerin interfaceClickHouseBinaryFormatReader- Parameters:
colName- - column name- Returns:
-
getLong
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a long.- Specified by:
getLongin interfaceClickHouseBinaryFormatReader- Parameters:
colName- - column name- Returns:
-
getFloat
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a float.- Specified by:
getFloatin interfaceClickHouseBinaryFormatReader- Returns:
-
getDouble
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a double.- Specified by:
getDoublein interfaceClickHouseBinaryFormatReader- Returns:
-
getBoolean
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a boolean.- Specified by:
getBooleanin interfaceClickHouseBinaryFormatReader- Returns:
-
getBigInteger
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a BigInteger.- Specified by:
getBigIntegerin interfaceClickHouseBinaryFormatReader- Returns:
-
getBigDecimal
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a BigDecimal.- Specified by:
getBigDecimalin interfaceClickHouseBinaryFormatReader- Returns:
-
getInstant
Description copied from interface:ClickHouseBinaryFormatReaderReturns 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.- Specified by:
getInstantin interfaceClickHouseBinaryFormatReader- Returns:
-
getZonedDateTime
Description copied from interface:ClickHouseBinaryFormatReaderReturns 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.- Specified by:
getZonedDateTimein interfaceClickHouseBinaryFormatReader- Returns:
-
getDuration
Description copied from interface:ClickHouseBinaryFormatReaderReturns 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.- Specified by:
getDurationin interfaceClickHouseBinaryFormatReader- Returns:
- Duration in the unit of column type.
-
getInet4Address
Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as an Inet4Address.- Specified by:
getInet4Addressin interfaceClickHouseBinaryFormatReader- Returns:
-
getInet6Address
Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as an Inet6Address.- Specified by:
getInet6Addressin interfaceClickHouseBinaryFormatReader- Returns:
-
getUUID
Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as a UUID.- Specified by:
getUUIDin interfaceClickHouseBinaryFormatReader- Returns:
-
getGeoPoint
Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as a ClickHouseGeoPointValue.- Specified by:
getGeoPointin interfaceClickHouseBinaryFormatReader- Returns:
-
getGeoRing
Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as a ClickHouseGeoRingValue.- Specified by:
getGeoRingin interfaceClickHouseBinaryFormatReader- Returns:
-
getGeoPolygon
Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as a ClickHouseGeoPolygonValue.- Specified by:
getGeoPolygonin interfaceClickHouseBinaryFormatReader- Returns:
-
getGeoMultiPolygon
Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as a ClickHouseGeoMultiPolygonValue.- Specified by:
getGeoMultiPolygonin interfaceClickHouseBinaryFormatReader- Returns:
-
getList
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getListin interfaceClickHouseBinaryFormatReader- Parameters:
colName- - column name- Returns:
-
getByteArray
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getByteArrayin interfaceClickHouseBinaryFormatReader- Parameters:
colName- - column name- Returns:
-
getIntArray
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getIntArrayin interfaceClickHouseBinaryFormatReader- Parameters:
colName- - column name- Returns:
-
getLongArray
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getLongArrayin interfaceClickHouseBinaryFormatReader- Parameters:
colName- - column name- Returns:
-
getFloatArray
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getFloatArrayin interfaceClickHouseBinaryFormatReader- Parameters:
colName- - column name- Returns:
-
getDoubleArray
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getDoubleArrayin interfaceClickHouseBinaryFormatReader- Parameters:
colName- - column name- Returns:
-
hasValue
public boolean hasValue(int colIndex) - Specified by:
hasValuein interfaceClickHouseBinaryFormatReader
-
hasValue
- Specified by:
hasValuein interfaceClickHouseBinaryFormatReader
-
getByte
public byte getByte(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a byte.- Specified by:
getBytein interfaceClickHouseBinaryFormatReader- Returns:
-
getShort
public short getShort(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a short.- Specified by:
getShortin interfaceClickHouseBinaryFormatReader- Returns:
-
getInteger
public int getInteger(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as an integer.- Specified by:
getIntegerin interfaceClickHouseBinaryFormatReader- Returns:
-
getLong
public long getLong(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a long.- Specified by:
getLongin interfaceClickHouseBinaryFormatReader- Returns:
-
getFloat
public float getFloat(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a float.- Specified by:
getFloatin interfaceClickHouseBinaryFormatReader- Returns:
-
getDouble
public double getDouble(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a double.- Specified by:
getDoublein interfaceClickHouseBinaryFormatReader- Returns:
-
getBoolean
public boolean getBoolean(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a boolean.- Specified by:
getBooleanin interfaceClickHouseBinaryFormatReader- Returns:
-
getBigInteger
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a BigInteger.- Specified by:
getBigIntegerin interfaceClickHouseBinaryFormatReader- Returns:
-
getBigDecimal
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a BigDecimal.- Specified by:
getBigDecimalin interfaceClickHouseBinaryFormatReader- Returns:
-
getInstant
Description copied from interface:ClickHouseBinaryFormatReaderReturns 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.- Specified by:
getInstantin interfaceClickHouseBinaryFormatReader- Returns:
-
getZonedDateTime
Description copied from interface:ClickHouseBinaryFormatReaderReturns 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.- Specified by:
getZonedDateTimein interfaceClickHouseBinaryFormatReader- Returns:
-
getDuration
Description copied from interface:ClickHouseBinaryFormatReaderReturns 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.- Specified by:
getDurationin interfaceClickHouseBinaryFormatReader- Returns:
- Duration in the unit of column type.
-
getInet4Address
Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as an Inet4Address.- Specified by:
getInet4Addressin interfaceClickHouseBinaryFormatReader- Returns:
-
getInet6Address
Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as an Inet6Address.- Specified by:
getInet6Addressin interfaceClickHouseBinaryFormatReader- Returns:
-
getUUID
Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as a UUID.- Specified by:
getUUIDin interfaceClickHouseBinaryFormatReader- Returns:
-
getGeoPoint
public com.clickhouse.data.value.ClickHouseGeoPointValue getGeoPoint(int index) Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as a ClickHouseGeoPointValue.- Specified by:
getGeoPointin interfaceClickHouseBinaryFormatReader- Returns:
-
getGeoRing
public com.clickhouse.data.value.ClickHouseGeoRingValue getGeoRing(int index) Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as a ClickHouseGeoRingValue.- Specified by:
getGeoRingin interfaceClickHouseBinaryFormatReader- Returns:
-
getGeoPolygon
public com.clickhouse.data.value.ClickHouseGeoPolygonValue getGeoPolygon(int index) Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as a ClickHouseGeoPolygonValue.- Specified by:
getGeoPolygonin interfaceClickHouseBinaryFormatReader- Returns:
-
getGeoMultiPolygon
public com.clickhouse.data.value.ClickHouseGeoMultiPolygonValue getGeoMultiPolygon(int index) Description copied from interface:ClickHouseBinaryFormatReaderReturns the value of the specified column as a ClickHouseGeoMultiPolygonValue.- Specified by:
getGeoMultiPolygonin interfaceClickHouseBinaryFormatReader- Returns:
-
getList
Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getListin interfaceClickHouseBinaryFormatReader- Parameters:
index- - column name- Returns:
-
getByteArray
public byte[] getByteArray(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getByteArrayin interfaceClickHouseBinaryFormatReader- Parameters:
index- - column name- Returns:
-
getIntArray
public int[] getIntArray(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getIntArrayin interfaceClickHouseBinaryFormatReader- Parameters:
index- - column name- Returns:
-
getLongArray
public long[] getLongArray(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getLongArrayin interfaceClickHouseBinaryFormatReader- Parameters:
index- - column name- Returns:
-
getFloatArray
public float[] getFloatArray(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getFloatArrayin interfaceClickHouseBinaryFormatReader- Parameters:
index- - column name- Returns:
-
getDoubleArray
public double[] getDoubleArray(int index) Description copied from interface:ClickHouseBinaryFormatReaderReads column with name `colName` as a string.- Specified by:
getDoubleArrayin interfaceClickHouseBinaryFormatReader- Parameters:
index- - column name- Returns:
-
getTuple
- Specified by:
getTuplein interfaceClickHouseBinaryFormatReader
-
getTuple
- Specified by:
getTuplein interfaceClickHouseBinaryFormatReader
-
getEnum8
- Specified by:
getEnum8in interfaceClickHouseBinaryFormatReader
-
getEnum8
public byte getEnum8(int index) - Specified by:
getEnum8in interfaceClickHouseBinaryFormatReader
-
getEnum16
- Specified by:
getEnum16in interfaceClickHouseBinaryFormatReader
-
getEnum16
public short getEnum16(int index) - Specified by:
getEnum16in interfaceClickHouseBinaryFormatReader
-
getLocalDate
- Specified by:
getLocalDatein interfaceClickHouseBinaryFormatReader
-
getLocalDate
- Specified by:
getLocalDatein interfaceClickHouseBinaryFormatReader
-
getLocalDateTime
- Specified by:
getLocalDateTimein interfaceClickHouseBinaryFormatReader
-
getLocalDateTime
- Specified by:
getLocalDateTimein interfaceClickHouseBinaryFormatReader
-