Package com.clickhouse.client.data
Class ClickHouseRowBinaryProcessor
- java.lang.Object
-
- com.clickhouse.client.ClickHouseDataProcessor
-
- com.clickhouse.client.data.ClickHouseRowBinaryProcessor
-
public class ClickHouseRowBinaryProcessor extends ClickHouseDataProcessor
Data processor for handlingClickHouseFormat.RowBinary
andClickHouseFormat.RowBinaryWithNamesAndTypes
two formats.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClickHouseRowBinaryProcessor.MappedFunctions
-
Field Summary
-
Fields inherited from class com.clickhouse.client.ClickHouseDataProcessor
columns, config, currentRecord, DEFAULT_COLUMNS, ERROR_FAILED_TO_READ, ERROR_FAILED_TO_WRITE, ERROR_REACHED_END_OF_STREAM, ERROR_UNKNOWN_DATA_TYPE, input, output, readPosition, records, settings, templates, values
-
-
Constructor Summary
Constructors Constructor Description ClickHouseRowBinaryProcessor(ClickHouseConfig config, ClickHouseInputStream input, ClickHouseOutputStream output, List<ClickHouseColumn> columns, Map<String,Object> settings)
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ClickHouseRecord
createRecord()
Factory method to create a record.static ClickHouseRowBinaryProcessor.MappedFunctions
getMappedFunctions()
protected void
readAndFill(ClickHouseRecord r)
Reads columns(starting fromreadPosition
) from input stream and fill deserialized data into the given record.protected void
readAndFill(ClickHouseValue value, ClickHouseColumn column)
Reads column(atreadPosition
from input stream and fill deserialized data into the given value object.protected List<ClickHouseColumn>
readColumns()
Reads columns from input stream.void
write(ClickHouseValue value, ClickHouseColumn column)
Writes serialized value to output stream.-
Methods inherited from class com.clickhouse.client.ClickHouseDataProcessor
buildAggMappings, buildMappings, getColumns, initRecords, initValues, read, records, values
-
-
-
-
Constructor Detail
-
ClickHouseRowBinaryProcessor
public ClickHouseRowBinaryProcessor(ClickHouseConfig config, ClickHouseInputStream input, ClickHouseOutputStream output, List<ClickHouseColumn> columns, Map<String,Object> settings) throws IOException
Default constructor.- Parameters:
config
- non-null confinguration contains information like formatinput
- input stream for deserialization, can be null whenoutput
is availableoutput
- outut stream for serialization, can be null wheninput
is availablecolumns
- nullable columnssettings
- nullable settings- Throws:
IOException
- when failed to read columns from input stream
-
-
Method Detail
-
getMappedFunctions
public static ClickHouseRowBinaryProcessor.MappedFunctions getMappedFunctions()
-
createRecord
protected ClickHouseRecord createRecord()
Description copied from class:ClickHouseDataProcessor
Factory method to create a record.- Specified by:
createRecord
in classClickHouseDataProcessor
- Returns:
- new record
-
readAndFill
protected void readAndFill(ClickHouseRecord r) throws IOException
Description copied from class:ClickHouseDataProcessor
Reads columns(starting fromreadPosition
) from input stream and fill deserialized data into the given record. This method is only used when iterating throughClickHouseDataProcessor.records()
.- Overrides:
readAndFill
in classClickHouseDataProcessor
- Parameters:
r
- non-null record to fill- Throws:
IOException
- when failed to read columns from input stream
-
readAndFill
protected void readAndFill(ClickHouseValue value, ClickHouseColumn column) throws IOException
Description copied from class:ClickHouseDataProcessor
Reads column(atreadPosition
from input stream and fill deserialized data into the given value object. This method is mainly used when iterating throughClickHouseDataProcessor.values()
. In default implementation, it's also used inClickHouseDataProcessor.readAndFill(ClickHouseRecord)
for simplicity.- Specified by:
readAndFill
in classClickHouseDataProcessor
- Parameters:
value
- non-null value object to fillcolumn
- non-null type of the value- Throws:
IOException
- when failed to read column from input stream
-
readColumns
protected List<ClickHouseColumn> readColumns() throws IOException
Description copied from class:ClickHouseDataProcessor
Reads columns from input stream. Usually this will be only called once during instantiation.- Specified by:
readColumns
in classClickHouseDataProcessor
- Returns:
- non-null list of columns
- Throws:
IOException
- when failed to read columns from input stream
-
write
public void write(ClickHouseValue value, ClickHouseColumn column) throws IOException
Description copied from class:ClickHouseDataProcessor
Writes serialized value to output stream.- Specified by:
write
in classClickHouseDataProcessor
- Parameters:
value
- non-null value to be serializedcolumn
- non-null type information- Throws:
IOException
- when failed to write data to output stream
-
-