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 TypeMethodDescriptionvoidThe 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.voidaddColumnSink(BaseAppendableColumnSink<?, ?> columnSink) Adds the column sink to the holder list of column sinks that are source by SinkHolder's Source columnprotected voidaddToAppendableColumn(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 StringBuilderbooleanReturns true if the column is defined in schema.booleanReturns true when the source name attribute inImporterColumnDefinitionis not null and the columnsAppendableColumnSink.isConstantColumn()attribute is not true.booleanReturns false if column type is not set toImporterColumnDefinition.IrisImportConstantin schemabooleanReturns true when theColumnDefinition.isPartitioning()attribute for the column is set to true.voidnullFlagsToValues(Object[] values, boolean[] isNull, int size) The method allows the appropriate null values to be populated in the chunk.voidonPartitionParserUpdate(PartitionParserUpdate parserUpdate) Updates are published by the source (CsvPartitionColumnParserorAppendableTableWrapper) by invoking this method.voidpublishToCustomSetter(Object[] values, boolean[] isNull, int size) The method will publish the values chunk toCustomSetterSinkDataProcessorif it is present and applicablebooleanData transformation is considered to be supported when at least one of transform attribute or formula attribute are defined for the column in schema.voidupdateCustomSetterData(int size, long destEnd) Allows custom setter columns to process updates to next chunk of rows.voidupdateRowChunk(int size, long destEnd) Allows columns not in csv source file to apply updates to next chunk of rows.voidwriteToLocal(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, validateForProcessingErrorsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, publishRowUpdateMethods inherited from interface com.illumon.iris.importers.csv.sink.AppendableSink
getConstantValue, getCustomSinkDataProcessor, getUnderlying, isCustomSetterColumn, updateNonSourceColRowChunk, validateForProcessingErrors, writeMethods 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:ColumnSinkHolderAdds the column sink to the holder list of column sinks that are source by SinkHolder's Source column- Specified by:
addColumnSinkin interfaceColumnSinkHolder<Object,Object[]> - Parameters:
columnSink- columnSink that is sourced by SinkHolder's Source column
-
getColumnSinks
Description copied from interface:ColumnSinkHolderReturns the list of ColumnSinks that are part of this SinkHolder.- Specified by:
getColumnSinksin interfaceColumnSinkHolder<Object,Object[]> - Returns:
- list of ColumnSinks that are part of this SinkHolder
-
isColumnInSource
public boolean isColumnInSource()Description copied from interface:AppendableColumnSinkReturns true when the source name attribute inImporterColumnDefinitionis not null and the columnsAppendableColumnSink.isConstantColumn()attribute is not true.- Specified by:
isColumnInSourcein interfaceAppendableColumnSink<Object,Object[]> - Overrides:
isColumnInSourcein 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:AppendableColumnSinkReturns 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
RowUpdateObserverthen row updates need to be published.- Specified by:
isColumnInSchemain interfaceAppendableColumnSink<Object,Object[]> - Overrides:
isColumnInSchemain classBaseAppendableColumnSink<Object,Object[]> - Returns:
- true if the column is defined in schema.
-
isPartitionCol
public boolean isPartitionCol()Description copied from interface:AppendableColumnSinkReturns true when theColumnDefinition.isPartitioning()attribute for the column is set to true.- Specified by:
isPartitionColin interfaceAppendableColumnSink<Object,Object[]> - Overrides:
isPartitionColin 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:AppendableColumnSinkData 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:
supportsTransformationsin interfaceAppendableColumnSink<Object,Object[]> - Overrides:
supportsTransformationsin 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:AppendableColumnSinkReturns false if column type is not set toImporterColumnDefinition.IrisImportConstantin schema- Specified by:
isConstantColumnin interfaceAppendableColumnSink<Object,Object[]> - Overrides:
isConstantColumnin 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:AppendableColumnSinkThe 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:
addin 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:BaseAppendableColumnSinkWrites to disk the contents of values array from chunkStartIndex to chunkSize in the appendable column of a particular partition- Specified by:
addToAppendableColumnin 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:PartitionUpdatesObserverUpdates are published by the source (CsvPartitionColumnParserorAppendableTableWrapper) by invoking this method.- Specified by:
onPartitionParserUpdatein interfacePartitionUpdatesObserver- Overrides:
onPartitionParserUpdatein classBaseAppendableColumnSink<Object,Object[]> - Parameters:
parserUpdate- Partition for current chunk.
-
getStringBuilderIncludingBasicSinkAttributes
- Overrides:
getStringBuilderIncludingBasicSinkAttributesin classBaseAppendableColumnSink<Object,Object[]>
-
nullFlagsToValues
Description copied from interface:AppendableSinkThe method allows the appropriate null values to be populated in the chunk.- Specified by:
nullFlagsToValuesin 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:AppendableSinkThe method will save the values chunk to disk.- Specified by:
writeToLocalin 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:AppendableSinkThe method will publish the values chunk toCustomSetterSinkDataProcessorif it is present and applicable- Specified by:
publishToCustomSetterin 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 positionimeans 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:AppendableSinkAllows 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:
updateRowChunkin 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:AppendableSinkAllows 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:
updateCustomSetterDatain interfaceAppendableSink<Object,Object[]> - Parameters:
size- The current chunk lengthdestEnd- The exclusive end index of the destination range.
- Pull data from
-