Class BaseAppendableColumnSink<DATA_TYPE,TARRAY>
java.lang.Object
com.illumon.iris.importers.csv.sink.BaseAppendableColumnSink<DATA_TYPE,TARRAY>
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable,PartitionUpdatesObserver,AppendableColumnSink<DATA_TYPE,TARRAY>,AppendableSink<DATA_TYPE,TARRAY>,io.deephaven.csv.sinks.Sink<TARRAY>,io.deephaven.csv.sinks.Source<TARRAY>
public abstract class BaseAppendableColumnSink<DATA_TYPE,TARRAY> extends Object implements AppendableColumnSink<DATA_TYPE,TARRAY>, io.deephaven.csv.sinks.Source<TARRAY>, com.fishlib.base.log.LogOutputAppendable
-
Field Summary
Fields Modifier and Type Field Description protected ImportColumnDataTransformercolumnDataTransformerprotected Map<String,LocalAppendableColumn<DATA_TYPE>>columnMapprotected StringcolumnNameprotected DATA_TYPEconstantValuestatic StringDEFAULT_PARTITION_COLprotected Set<String>evictedPartitionsprotected booleanisColumnInSchemaprotected booleanisColumnInSourceprotected booleanisFromSplitFileprotected booleanisPartitionColprotected booleanschemaHasPartitionColprotected RowUpdateObserverupdateObserverstatic BaseAppendableColumnSink[]ZERO_LENGTH_WRAPPER_ARRAY -
Constructor Summary
Constructors Modifier Constructor Description protectedBaseAppendableColumnSink(com.fishlib.io.logger.Logger log, String columnName, ImporterColumnDefinition icdColDef, ImportColumnDataTransformer columnDataTransformer, boolean isPartitionCol, boolean isColumnInSchema, boolean isColumnInSource, boolean schemaHasPartitionCol, boolean fromSplitFile) -
Method Summary
Modifier and Type Method Description voidaddAppendableColumn(String partition, LocalAppendableColumn<DATA_TYPE> appendableColumn)The method provides the partition and its associatedLocalAppendableColumnThis information should be cached in the column sink implementation and should be used when updating the column values based onPartitionParserUpdatethat will be pushed to the column when the table has a partitioning column and the values of the column should be persisted in the appropriate partition.protected abstract voidaddToAppendableColumn(LocalAppendableColumn<DATA_TYPE> appendableColumn, TARRAY 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 partitioncom.fishlib.base.log.LogOutputappend(com.fishlib.base.log.LogOutput logOutput)voidevict(String partition)The provided partition should be evicted from the current partition column cache.ImportColumnDataTransformergetColumnDataTransformer()Getter for ColumnDataTransformerStringgetColumnName()Getter for column nameDATA_TYPEgetConstantValue()Returns the defined constant value in case of a constant column value.booleanisColumnInSchema()Returns true if the column is present in schema associated with the csv importbooleanisColumnInSource()Returns true if the column is present in the source csv file.booleanisConstantColumn()Returns true if the ColumnDataTransformer has the hasConstant attribute return truebooleanisPartitionCol()Returns true if the column is defined as a partition column in the schemavoidonPartitionParserUpdate(PartitionParserUpdate parserUpdate)Updates are published by the source (CsvPartitionColumnParserorAppendableTableWrapper) by invoking this method.voidpublishRowUpdate(int size, long end)Publish row updates to interested sinks.voidread(TARRAY dest, boolean[] isNull, long srcBegin, long srcEnd)voidregisterRowUpdateObserver(RowUpdateObserver rowUpdateObserver)Used to set the RowUpdateObserver for one of the column sinks that are in csv source file.booleansupportsTransformations()Returns true if the ColumnDataTransformer supports transformationStringtoString()protected voidupdateLocalAppendableColumn(TARRAY values, long destEnd, boolean isSingleValue)Blocks until the partition column is parsed for the same chunk.Methods 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
add, addBooleans, addBytes, addChars, addDoubles, addFloats, addInts, addLongs, addShorts, isColumnOnlyInSchemaMethods inherited from interface com.illumon.iris.importers.csv.sink.AppendableSink
getUnderlying, nullFlagsToValues, updateRowChunk, write, writeToLocal
-
Field Details
-
ZERO_LENGTH_WRAPPER_ARRAY
-
DEFAULT_PARTITION_COL
- See Also:
- Constant Field Values
-
columnDataTransformer
-
constantValue
-
columnName
-
isPartitionCol
protected final boolean isPartitionCol -
isColumnInSchema
protected final boolean isColumnInSchema -
isColumnInSource
protected final boolean isColumnInSource -
schemaHasPartitionCol
protected final boolean schemaHasPartitionCol -
isFromSplitFile
protected final boolean isFromSplitFile -
columnMap
-
evictedPartitions
-
updateObserver
-
-
Constructor Details
-
BaseAppendableColumnSink
protected BaseAppendableColumnSink(@NotNull com.fishlib.io.logger.Logger log, @NotNull String columnName, @Nullable ImporterColumnDefinition icdColDef, @Nullable ImportColumnDataTransformer columnDataTransformer, boolean isPartitionCol, boolean isColumnInSchema, boolean isColumnInSource, boolean schemaHasPartitionCol, boolean fromSplitFile)
-
-
Method Details
-
getConstantValue
Description copied from interface:AppendableSinkReturns the defined constant value in case of a constant column value. Constant value definition is present in the importColumn xml element. The value will be accessible through ImportDataTransformer- Specified by:
getConstantValuein interfaceAppendableSink<DATA_TYPE,TARRAY>
-
getColumnName
Description copied from interface:AppendableColumnSinkGetter for column name- Specified by:
getColumnNamein interfaceAppendableColumnSink<DATA_TYPE,TARRAY>
-
isColumnInSchema
public boolean isColumnInSchema()Description copied from interface:AppendableColumnSinkReturns true if the column is present in schema associated with the csv import- Specified by:
isColumnInSchemain interfaceAppendableColumnSink<DATA_TYPE,TARRAY>
-
isColumnInSource
public boolean isColumnInSource()Description copied from interface:AppendableColumnSinkReturns true if the column is present in the source csv file. This is determined by whether the column name exists in the columnNamesInFile attribute of CsvImportHelper- Specified by:
isColumnInSourcein interfaceAppendableColumnSink<DATA_TYPE,TARRAY>
-
isPartitionCol
public boolean isPartitionCol()Description copied from interface:AppendableColumnSinkReturns true if the column is defined as a partition column in the schema- Specified by:
isPartitionColin interfaceAppendableColumnSink<DATA_TYPE,TARRAY>
-
supportsTransformations
public boolean supportsTransformations()Description copied from interface:AppendableColumnSinkReturns true if the ColumnDataTransformer supports transformation- Specified by:
supportsTransformationsin interfaceAppendableColumnSink<DATA_TYPE,TARRAY>
-
getColumnDataTransformer
Description copied from interface:AppendableColumnSinkGetter for ColumnDataTransformer- Specified by:
getColumnDataTransformerin interfaceAppendableColumnSink<DATA_TYPE,TARRAY>
-
isConstantColumn
public boolean isConstantColumn()Description copied from interface:AppendableColumnSinkReturns true if the ColumnDataTransformer has the hasConstant attribute return true- Specified by:
isConstantColumnin interfaceAppendableColumnSink<DATA_TYPE,TARRAY>
-
toString
-
registerRowUpdateObserver
Used to set the RowUpdateObserver for one of the column sinks that are in csv source file.- Parameters:
rowUpdateObserver- A RowUpdateObserver to which the row chunk attribute (size and destEnd ) can be published
-
publishRowUpdate
public void publishRowUpdate(int size, long end)Publish row updates to interested sinks.- Specified by:
publishRowUpdatein interfaceAppendableColumnSink<DATA_TYPE,TARRAY>
-
addAppendableColumn
public void addAppendableColumn(@Nullable String partition, @Nullable LocalAppendableColumn<DATA_TYPE> appendableColumn)Description copied from interface:AppendableColumnSinkThe method provides the partition and its associatedLocalAppendableColumnThis information should be cached in the column sink implementation and should be used when updating the column values based onPartitionParserUpdatethat will be pushed to the column when the table has a partitioning column and the values of the column should be persisted in the appropriate partition.- Specified by:
addAppendableColumnin interfaceAppendableColumnSink<DATA_TYPE,TARRAY>- Parameters:
partition- Partition value as a stringappendableColumn- The LocalAppendableColumn of the column associated for this partition
-
evict
Description copied from interface:AppendableColumnSinkThe provided partition should be evicted from the current partition column cache. This should be registered as one of the evicted partitions.- Specified by:
evictin interfaceAppendableColumnSink<DATA_TYPE,TARRAY>- Parameters:
partition- Partition value as a string, that should be evicted from the local column cache of partitions
-
addToAppendableColumn
protected abstract void addToAppendableColumn(@NotNull LocalAppendableColumn<DATA_TYPE> appendableColumn, @NotNull TARRAY 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 partition- 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
-
updateLocalAppendableColumn
protected void updateLocalAppendableColumn(@NotNull TARRAY values, long destEnd, boolean isSingleValue)Blocks until the partition column is parsed for the same chunk. -
onPartitionParserUpdate
Description copied from interface:PartitionUpdatesObserverUpdates are published by the source (CsvPartitionColumnParserorAppendableTableWrapper) by invoking this method.- Specified by:
onPartitionParserUpdatein interfacePartitionUpdatesObserver- Parameters:
parserUpdate- Partition for current chunk.
-
read
- Specified by:
readin interfaceio.deephaven.csv.sinks.Source<DATA_TYPE>
-
append
public com.fishlib.base.log.LogOutput append(@NotNull com.fishlib.base.log.LogOutput logOutput)- Specified by:
appendin interfacecom.fishlib.base.log.LogOutputAppendable
-