Package com.clickhouse.data
Class ClickHouseDataProcessor
java.lang.Object
com.clickhouse.data.ClickHouseDataProcessor
Deprecated.
This defines a data processor for dealing with serialization and
deserialization of one or multiple
ClickHouseFormat. Unlike
ClickHouseDeserializer and ClickHouseSerializer, which is for
specific column or data type, data processor is a combination of both, and it
can handle more scenarios like separator between columns and rows.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classDeprecated.protected static final classDeprecated. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ClickHouseDataConfigDeprecated.static final List<ClickHouseColumn>Deprecated.protected static final StringDeprecated.protected static final StringDeprecated.protected static final StringDeprecated.protected static final StringDeprecated.protected final Map<String,Serializable> Deprecated.protected final ClickHouseInputStreamDeprecated.protected final ClickHouseOutputStreamDeprecated.protected intDeprecated.protected ClickHouseDataProcessor.DefaultSerDeDeprecated.protected intDeprecated.Column index shared bywrite(ClickHouseValue). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClickHouseDataProcessor(ClickHouseDataConfig config, ClickHouseInputStream input, ClickHouseOutputStream output, List<ClickHouseColumn> columns, Map<String, Serializable> settings) Deprecated.Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected ClickHouseDeserializer[]Deprecated.Builds list of steps to deserialize value for the given column.protected ClickHouseSerializer[]buildSerializeSteps(ClickHouseColumn column) Deprecated.Builds list of steps to serialize value for the given column.final List<ClickHouseColumn>Deprecated.Gets list of columns to process.abstract ClickHouseDeserializergetDeserializer(ClickHouseDataConfig config, ClickHouseColumn column) Deprecated.final ClickHouseDeserializer[]getDeserializers(ClickHouseDataConfig config, List<ClickHouseColumn> columns) Deprecated.<T extends Serializable>
TgetExtraProperty(String key, Class<T> valueClass) Deprecated.Gets a typed extra property.protected final ClickHouseDataProcessor.DefaultSerDeDeprecated.final ClickHouseInputStreamDeprecated.Gets input stream.final ClickHouseOutputStreamDeprecated.Gets output stream.abstract ClickHouseSerializergetSerializer(ClickHouseDataConfig config, ClickHouseColumn column) Deprecated.final ClickHouseSerializer[]getSerializers(ClickHouseDataConfig config, List<ClickHouseColumn> columns) Deprecated.booleanDeprecated.Checks whether the processor contains extra property.protected booleanDeprecated.Checks whether there's more to read from input stream.protected Iterator<ClickHouseRecord>Deprecated.Initializes iterator ofClickHouseRecordfor reading values record by record.protected Iterator<ClickHouseValue>Deprecated.Initializes iterator ofClickHouseValuefor reading values one by one.read(ClickHouseValue value) Deprecated.Reads deserialized value of next column(atreadPosition) directly from input stream.protected voidDeprecated.Reads columns(starting fromreadPosition) from input stream and fill deserialized data into the given record.protected voidreadAndFill(ClickHouseValue value) Deprecated.Reads next column(atreadPositionfrom input stream and fill deserialized data into the given value object.protected abstract List<ClickHouseColumn>Deprecated.Reads columns from input stream.final Iterable<ClickHouseRecord>records()Deprecated.Returns an iterable collection of records which can be walked through in a foreach-loop.final <T> Iterable<T>Deprecated.Returns an iterable collection of mapped objects which can be walked through in a foreach loop.<T> Iterable<T>Deprecated.Returns an iterable collection of mapped objects which can be walked through in a foreach loop.final Iterable<ClickHouseValue>values()Deprecated.Returns an iterable collection of values which can be walked through in a foreach-loop.voidwrite(ClickHouseValue value) Deprecated.Writes serialized value of next column(atreadPosition) to output stream.
-
Field Details
-
DEFAULT_COLUMNS
Deprecated. -
ERROR_FAILED_TO_READ
Deprecated.- See Also:
-
ERROR_FAILED_TO_WRITE
Deprecated.- See Also:
-
ERROR_REACHED_END_OF_STREAM
Deprecated.- See Also:
-
ERROR_UNKNOWN_DATA_TYPE
Deprecated.- See Also:
-
config
Deprecated. -
input
Deprecated. -
output
Deprecated. -
extraProps
Deprecated. -
serde
Deprecated. -
readPosition
protected int readPositionDeprecated. -
writePosition
protected int writePositionDeprecated.Column index shared bywrite(ClickHouseValue).
-
-
Constructor Details
-
ClickHouseDataProcessor
protected ClickHouseDataProcessor(ClickHouseDataConfig config, ClickHouseInputStream input, ClickHouseOutputStream output, List<ClickHouseColumn> columns, Map<String, Serializable> settings) throws IOExceptionDeprecated.Default constructor.- Parameters:
config- non-null confinguration contains information like formatinput- input stream for deserialization, can be null whenoutputis availableoutput- outut stream for serialization, can be null wheninputis availablecolumns- nullable columnssettings- nullable settings- Throws:
IOException- when failed to read columns from input stream
-
-
Method Details
-
hasMoreToRead
Deprecated.Checks whether there's more to read from input stream.- Returns:
- true if there's more; false otherwise
- Throws:
UncheckedIOException- when failed to read data from input stream
-
buildDeserializeSteps
Deprecated.Builds list of steps to deserialize value for the given column.- Parameters:
column- non-null column- Returns:
- non-null list of steps for deserialization
-
buildSerializeSteps
Deprecated.Builds list of steps to serialize value for the given column.- Parameters:
column- non-null column- Returns:
- non-null list of steps for serialization
-
getInitializedSerDe
protected final ClickHouseDataProcessor.DefaultSerDe getInitializedSerDe() throws UncheckedIOExceptionDeprecated.- Throws:
UncheckedIOException
-
initRecords
Deprecated.Initializes iterator ofClickHouseRecordfor reading values record by record. Usually this should be only called once during instantiation.- Returns:
- non-null iterator of
ClickHouseRecord
-
initValues
Deprecated.Initializes iterator ofClickHouseValuefor reading values one by one. Usually this should be only called once during instantiation.- Returns:
- non-null iterator of
ClickHouseValue
-
readAndFill
Deprecated.Reads columns(starting fromreadPosition) from input stream and fill deserialized data into the given record. This method is only used when iterating throughrecords().- Parameters:
r- non-null record to fill- Throws:
IOException- when failed to read columns from input stream
-
readAndFill
Deprecated.Reads next column(atreadPositionfrom input stream and fill deserialized data into the given value object. This method is mainly used when iterating throughvalues(). In default implementation, it's also used inreadAndFill(ClickHouseRecord)for simplicity.- Parameters:
value- non-null value object to fill- Throws:
IOException- when failed to read column from input stream
-
readColumns
Deprecated.Reads columns from input stream. Usually this will be only called once during instantiation.- Returns:
- non-null list of columns
- Throws:
IOException- when failed to read columns from input stream
-
hasExtraProperties
public boolean hasExtraProperties()Deprecated.Checks whether the processor contains extra property.- Returns:
- true if the processor has extra property; false otherwise
-
getExtraProperty
Deprecated.Gets a typed extra property.- Type Parameters:
T- type of the property value- Parameters:
key- key of the propertyvalueClass- non-null Java class of the property value- Returns:
- typed extra property, could be null
-
getDeserializer
public abstract ClickHouseDeserializer getDeserializer(ClickHouseDataConfig config, ClickHouseColumn column) Deprecated. -
getDeserializers
public final ClickHouseDeserializer[] getDeserializers(ClickHouseDataConfig config, List<ClickHouseColumn> columns) Deprecated. -
getSerializer
public abstract ClickHouseSerializer getSerializer(ClickHouseDataConfig config, ClickHouseColumn column) Deprecated. -
getSerializers
public final ClickHouseSerializer[] getSerializers(ClickHouseDataConfig config, List<ClickHouseColumn> columns) Deprecated. -
getColumns
Deprecated.Gets list of columns to process.- Returns:
- list of columns to process
-
getInputStream
Deprecated.Gets input stream.- Returns:
- input stream, could be null
-
getOutputStream
Deprecated.Gets output stream.- Returns:
- output stream, could be null
-
records
Deprecated.Returns an iterable collection of records which can be walked through in a foreach-loop. Please pay attention that: 1)UncheckedIOExceptionmight be thrown when iterating through the collection; and 2) it's not supposed to be called for more than once because the input stream will be closed at the end of reading.- Returns:
- non-null iterable records
- Throws:
UncheckedIOException- when failed to access the input stream
-
records
Deprecated.Returns an iterable collection of mapped objects which can be walked through in a foreach loop. Same asrecords(objClass, null).- 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)
-
records
Deprecated.Returns an iterable collection of mapped objects which can be walked through in a foreach loop. WhenobjClassis null orClickHouseRecord, this is same as callingrecords().- Type Parameters:
T- type of the mapped object- Parameters:
objClass- non-null class of the mapped objecttemplate- optional template object to reuse- Returns:
- non-null iterable collection
- Throws:
UncheckedIOException- when failed to read data(e.g. deserialization)
-
values
Deprecated.Returns an iterable collection of values which can be walked through in a foreach-loop. In general, this is slower thanrecords(), because the latter reads data in bulk. However, it's particular useful when you're reading large values with limited memory - e.g. a binary field with a few GB bytes. Similarly, the input stream will be closed at the end of reading.- Returns:
- non-null iterable values
- Throws:
UncheckedIOException- when failed to access the input stream
-
read
Deprecated.Reads deserialized value of next column(atreadPosition) directly from input stream. Unlikerecords(), which reads multiple values at a time, this method will only read one for each call.- Parameters:
value- value to update, could be null- Returns:
- updated
valueor a newClickHouseValuewhen it is null - Throws:
IOException- when failed to read data from input stream
-
write
Deprecated.Writes serialized value of next column(atreadPosition) to output stream.- Parameters:
value- non-null value to be serialized- Throws:
IOException- when failed to write data to output stream
-