Class AppendableColumnSinkHolder
java.lang.Object
com.illumon.iris.importers.csv.sink.BaseAppendableColumnSink<Object,Object[]>
com.illumon.iris.importers.csv.sink.AppendableColumnSinkHolder
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable
,PartitionUpdatesObserver
,RowUpdateObservable
,AppendableColumnSink<Object,
,Object[]> AppendableSink<Object,
,Object[]> ColumnSinkHolder<Object,
,Object[]> io.deephaven.csv.sinks.Sink<Object[]>
,io.deephaven.csv.sinks.Source<Object[]>
public final class AppendableColumnSinkHolder
extends BaseAppendableColumnSink<Object,Object[]>
implements ColumnSinkHolder<Object,Object[]>
This column sink is a wrapper that holds multiple column sinks that are sourced from the same source column.
This by itself will not write anything to disk but acts as the sink that DHC parser attaches to the source column.
The parser for this column will delegate to the parsers of member column sinks.
-
Field Summary
Fields inherited from class com.illumon.iris.importers.csv.sink.BaseAppendableColumnSink
baseFieldWriter, columnDataTransformer, columnMap, columnName, constantValue, customSetterCol, DEFAULT_PARTITION_COL, evictedPartitions, isColumnInSchema, isColumnInSource, isFromSplitFile, isPartitionCol, schemaHasPartitionCol, sinkDataProcessor, updateObserver, ZERO_LENGTH_WRAPPER_ARRAY
-
Constructor Summary
ConstructorsConstructorDescriptionAppendableColumnSinkHolder
(com.fishlib.io.logger.Logger log, String columnName) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
The wrapper method around theBaseAppendableColumn.add(Object[], int, int)
The method should make sure the received values are persisted to the right partitions when the table schema supports partitions.void
addColumnSink
(BaseAppendableColumnSink<?, ?> columnSink) Adds the column sink to the holder list of column sinks that are source by SinkHolder's Source columnprotected void
addToAppendableColumn
(LocalAppendableColumn<Object> appendableColumn, Object[] values, int chunkStartIndex, int chunkSize, boolean isSingleValue) Writes to disk the contents of values array from chunkStartIndex to chunkSize in the appendable column of a particular partitionList<BaseAppendableColumnSink<?,
?>> Returns the list of ColumnSinks that are part of this SinkHolder.protected StringBuilder
boolean
Returns true if the column is defined in schema.boolean
Returns true when the source name attribute inImporterColumnDefinition
is not null and the columnsAppendableColumnSink.isConstantColumn()
attribute is not true.boolean
Returns false if column type is not set toImporterColumnDefinition.IrisImportConstant
in schemaboolean
Returns true when theColumnDefinition.isPartitioning()
attribute for the column is set to true.void
nullFlagsToValues
(Object[] values, boolean[] isNull, int size) The method allows the appropriate null values to be populated in the chunk.void
onPartitionParserUpdate
(PartitionParserUpdate parserUpdate) Updates are published by the source (CsvPartitionColumnParser
orAppendableTableWrapper
) by invoking this method.void
publishToCustomSetter
(Object[] values, boolean[] isNull, int size) The method will publish the values chunk toCustomSetterSinkDataProcessor
if it is present and applicableboolean
Data transformation is considered to be supported when at least one of transform attribute or formula attribute are defined for the column in schema.void
updateCustomSetterData
(int size, long destEnd) Allows custom setter columns to process updates to next chunk of rows.void
updateRowChunk
(int size, long destEnd) Allows columns not in csv source file to apply updates to next chunk of rows.void
writeToLocal
(Object[] values, int size, long destEnd) The method will save the values chunk to disk.Methods inherited from class com.illumon.iris.importers.csv.sink.BaseAppendableColumnSink
addAppendableColumn, append, awaitAdvance, evict, flush, getColumnDataTransformer, getColumnName, getConstantValue, getCsvSourceColumnName, getCustomSinkDataProcessor, isCustomSetterColumn, isNotConsideredPartSourceFileMapping, processingComplete, processingFailed, publishRowUpdate, read, registerRowUpdateObserver, setColumnIsInSinkHolder, setRowUpdatePhaser, toString, updateLocalAppendableColumn, validateForProcessingErrors
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.illumon.iris.importers.csv.sink.AppendableColumnSink
addAppendableColumn, addBooleans, addBytes, addChars, addDoubles, addFloats, addInts, addLongs, addShorts, evict, getColumnDataTransformer, getColumnName, getCsvSourceColumnName, isColumnOnlyInSchema, isNotConsideredPartSourceFileMapping, publishRowUpdate
Methods inherited from interface com.illumon.iris.importers.csv.sink.AppendableSink
getConstantValue, getCustomSinkDataProcessor, getUnderlying, isCustomSetterColumn, updateNonSourceColRowChunk, validateForProcessingErrors, write
Methods inherited from interface com.illumon.iris.importers.csv.RowUpdateObservable
registerRowUpdateObserver
-
Constructor Details
-
AppendableColumnSinkHolder
public AppendableColumnSinkHolder(@NotNull com.fishlib.io.logger.Logger log, @NotNull String columnName) Constructor.- Parameters:
log
- The passed in logger needed in Base classcolumnName
- The source column name
-
-
Method Details
-
addColumnSink
Description copied from interface:ColumnSinkHolder
Adds the column sink to the holder list of column sinks that are source by SinkHolder's Source column- Specified by:
addColumnSink
in interfaceColumnSinkHolder<Object,
Object[]> - Parameters:
columnSink
- columnSink that is sourced by SinkHolder's Source column
-
getColumnSinks
Description copied from interface:ColumnSinkHolder
Returns the list of ColumnSinks that are part of this SinkHolder.- Specified by:
getColumnSinks
in interfaceColumnSinkHolder<Object,
Object[]> - Returns:
- list of ColumnSinks that are part of this SinkHolder
-
isColumnInSource
public boolean isColumnInSource()Description copied from interface:AppendableColumnSink
Returns true when the source name attribute inImporterColumnDefinition
is not null and the columnsAppendableColumnSink.isConstantColumn()
attribute is not true.- Specified by:
isColumnInSource
in interfaceAppendableColumnSink<Object,
Object[]> - Overrides:
isColumnInSource
in classBaseAppendableColumnSink<Object,
Object[]> - Returns:
- true if the column name or source column name in schema is present in the source csv file.
-
isColumnInSchema
public boolean isColumnInSchema()Description copied from interface:AppendableColumnSink
Returns true if the column is defined in schema.A source csv may have columns that are not defined in the schema. Those columns need to be identified, so they can be handled appropriately to satisfy dhc plumbing requirements. In addition, if such a column is designated to be
RowUpdateObserver
then row updates need to be published.- Specified by:
isColumnInSchema
in interfaceAppendableColumnSink<Object,
Object[]> - Overrides:
isColumnInSchema
in classBaseAppendableColumnSink<Object,
Object[]> - Returns:
- true if the column is defined in schema.
-
isPartitionCol
public boolean isPartitionCol()Description copied from interface:AppendableColumnSink
Returns true when theColumnDefinition.isPartitioning()
attribute for the column is set to true.- Specified by:
isPartitionCol
in interfaceAppendableColumnSink<Object,
Object[]> - Overrides:
isPartitionCol
in classBaseAppendableColumnSink<Object,
Object[]> - Returns:
- true if the column is defined as a partition column in the schema
-
supportsTransformations
public boolean supportsTransformations()Description copied from interface:AppendableColumnSink
Data transformation is considered to be supported when at least one of transform attribute or formula attribute are defined for the column in schema. When data transformation is supported the corresponding parser should use the generated transformer to transform the source file values.- Specified by:
supportsTransformations
in interfaceAppendableColumnSink<Object,
Object[]> - Overrides:
supportsTransformations
in classBaseAppendableColumnSink<Object,
Object[]> - Returns:
- true when at least one of formula or transform attribute is defined in schema for the column
-
isConstantColumn
public boolean isConstantColumn()Description copied from interface:AppendableColumnSink
Returns false if column type is not set toImporterColumnDefinition.IrisImportConstant
in schema- Specified by:
isConstantColumn
in interfaceAppendableColumnSink<Object,
Object[]> - Overrides:
isConstantColumn
in classBaseAppendableColumnSink<Object,
Object[]> - Returns:
- true if the ColumnDataTransformer has the hasConstant attribute as true
-
add
public void add(@NotNull Object[] values, int startIndex, int length, long destEnd, boolean isSingleValue) Description copied from interface:AppendableColumnSink
The wrapper method around theBaseAppendableColumn.add(Object[], int, int)
The method should make sure the received values are persisted to the right partitions when the table schema supports partitions. To allow for this, the persisting of values may be blocked until the partition column is processed for the same chunk. In addition, if other columns have registered an interest in receiving current chunk details then that information should be published as the first operation.- Specified by:
add
in interfaceAppendableColumnSink<Object,
Object[]> - Parameters:
values
- The values to be persisted in the chunkstartIndex
- The start index at which to persistlength
- The length of the values that should be persisted as part of this chunkdestEnd
- The total no of rows processed up to the end of this chunkisSingleValue
- If all the values for the update are the same constant value
-
addToAppendableColumn
protected void addToAppendableColumn(@NotNull LocalAppendableColumn<Object> appendableColumn, @NotNull Object[] values, int chunkStartIndex, int chunkSize, boolean isSingleValue) Description copied from class:BaseAppendableColumnSink
Writes to disk the contents of values array from chunkStartIndex to chunkSize in the appendable column of a particular partition- Specified by:
addToAppendableColumn
in classBaseAppendableColumnSink<Object,
Object[]> - Parameters:
appendableColumn
- The LocalAppendableColumn of the current partitionvalues
- The array whose contents need to be written to disk for this column and partitionchunkStartIndex
- The start index in the values arraychunkSize
- The length of data from the start index that need to be written to diskisSingleValue
- This indicates that entire chunk needs to be updated using a single value which is the constant value
-
onPartitionParserUpdate
Description copied from interface:PartitionUpdatesObserver
Updates are published by the source (CsvPartitionColumnParser
orAppendableTableWrapper
) by invoking this method.- Specified by:
onPartitionParserUpdate
in interfacePartitionUpdatesObserver
- Overrides:
onPartitionParserUpdate
in classBaseAppendableColumnSink<Object,
Object[]> - Parameters:
parserUpdate
- Partition for current chunk.
-
getStringBuilderIncludingBasicSinkAttributes
- Overrides:
getStringBuilderIncludingBasicSinkAttributes
in classBaseAppendableColumnSink<Object,
Object[]>
-
nullFlagsToValues
Description copied from interface:AppendableSink
The method allows the appropriate null values to be populated in the chunk.- Specified by:
nullFlagsToValues
in interfaceAppendableSink<Object,
Object[]> - Parameters:
values
- The chunk to populate null values if 'isNull' param is true for the indexisNull
- Indicates if the cell should be null valuesize
- The size of the values array that should be persisted
-
writeToLocal
Description copied from interface:AppendableSink
The method will save the values chunk to disk.- Specified by:
writeToLocal
in interfaceAppendableSink<Object,
Object[]> - Parameters:
values
- The current chunk ready to be persistedsize
- The size of the values array that should be persisteddestEnd
- The exclusive end index of the destination range.
-
publishToCustomSetter
Description copied from interface:AppendableSink
The method will publish the values chunk toCustomSetterSinkDataProcessor
if it is present and applicable- Specified by:
publishToCustomSetter
in interfaceAppendableSink<Object,
Object[]> - Parameters:
values
- The current chunk ready to be persistedisNull
- A boolean array, with the same range of valid elements. A "true" value at positioni
means thatsrc[i]
should be ignored and the element should be considered as the "null value".size
- The size of the values array that should be persisted
-
updateRowChunk
public void updateRowChunk(int size, long destEnd) Description copied from interface:AppendableSink
Allows columns not in csv source file to apply updates to next chunk of rows. For example constant column values are not part of the csv source file, they will receive current row chunk details by registering with a row that is in csv source file.- Specified by:
updateRowChunk
in interfaceAppendableSink<Object,
Object[]> - Parameters:
size
- The current chunk lengthdestEnd
- The exclusive end index of the destination range.
-
updateCustomSetterData
public void updateCustomSetterData(int size, long destEnd) Description copied from interface:AppendableSink
Allows custom setter columns to process updates to next chunk of rows. These are the steps that are expected to be done in implementing classes- Pull data from
CustomSetterSinkDataProcessor.getAllColumnDataMap(String)
- loop across individual row and invoke
BaseCsvFieldWriter.processValues(Map, int, long)
- Pull and populate columns value array at the index using processed value from
BaseCsvFieldWriter.getSetterValue()
- invoke appropriate type based add call, with singleValue flag set to false
- Specified by:
updateCustomSetterData
in interfaceAppendableSink<Object,
Object[]> - Parameters:
size
- The current chunk lengthdestEnd
- The exclusive end index of the destination range.
- Pull data from
-