Class ArrayBackedColumnSource<T>
java.lang.Object
io.deephaven.engine.table.impl.AbstractColumnSource<T>
io.deephaven.engine.table.impl.sources.ArrayBackedColumnSource<T>
- All Implemented Interfaces:
ChunkSink<Values>,ChunkSource<Values>,ChunkSource.WithPrev<Values>,ColumnSource<T>,ElementSource<T>,FillContextMaker,GetContextMaker,DefaultChunkSource<Values>,DefaultChunkSource.WithPrev<Values>,PushdownFilterMatcher,ChunkedBackingStoreExposedWritableSource,FillUnordered<Values>,InMemoryColumnSource,Releasable,TupleExporter<T>,TupleSource<T>,WritableColumnSource<T>
- Direct Known Subclasses:
BooleanArraySource,ByteArraySource,CharacterArraySource,DoubleArraySource,FloatArraySource,IntegerArraySource,LongArraySource,ObjectArraySource,ShortArraySource
public abstract class ArrayBackedColumnSource<T>
extends AbstractColumnSource<T>
implements FillUnordered<Values>, WritableColumnSource<T>, InMemoryColumnSource, ChunkedBackingStoreExposedWritableSource
A ColumnSource backed by in-memory arrays of data.
The column source is dense with keys from 0 to capacity, there can be no holes. Arrays are divided into blocks so that the column source can be incrementally expanded without copying data from one array to another.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.deephaven.engine.table.impl.AbstractColumnSource
AbstractColumnSource.DefaultedImmutable<DATA_TYPE>, AbstractColumnSource.DefaultedMutable<DATA_TYPE>Nested classes/interfaces inherited from interface io.deephaven.engine.table.ChunkSink
ChunkSink.FillFromContextNested classes/interfaces inherited from interface io.deephaven.engine.table.ChunkSource
ChunkSource.FillContext, ChunkSource.GetContext, ChunkSource.WithPrev<ATTR extends Any>Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.DefaultChunkSource
DefaultChunkSource.SupportsContiguousGet<ATTR extends Any>, DefaultChunkSource.WithPrev<ATTR extends Any>Nested classes/interfaces inherited from interface io.deephaven.engine.table.TupleExporter
TupleExporter.ExportElementFunction<TUPLE_TYPE>Nested classes/interfaces inherited from interface io.deephaven.engine.table.WritableColumnSource
WritableColumnSource.ByteFiller, WritableColumnSource.CharFiller, WritableColumnSource.DoubleFiller, WritableColumnSource.FloatFiller, WritableColumnSource.IntFiller, WritableColumnSource.LongFiller, WritableColumnSource.ObjectFiller, WritableColumnSource.ShortFiller, WritableColumnSource.SinkFiller -
Field Summary
FieldsFields inherited from class io.deephaven.engine.table.impl.AbstractColumnSource
componentType, type, updateGraph, USE_RANGES_AVERAGE_RUN_LENGTHFields inherited from interface io.deephaven.engine.table.ChunkSink
DEFAULT_FILL_FROM_INSTANCEFields inherited from interface io.deephaven.engine.table.ChunkSource
DEFAULT_FILL_INSTANCE, ZERO_LENGTH_CHUNK_SOURCE_ARRAYFields inherited from interface io.deephaven.engine.table.ChunkSource.WithPrev
ZERO_LENGTH_CHUNK_SOURCE_WITH_PREV_ARRAYFields inherited from interface io.deephaven.engine.table.ColumnSource
ZERO_LENGTH_COLUMN_SOURCE_ARRAYFields inherited from interface io.deephaven.engine.table.impl.sources.InMemoryColumnSource
TWO_DIMENSIONAL_COLUMN_SOURCE_THRESHOLD -
Method Summary
Modifier and TypeMethodDescriptionabstract voidensureCapacity(long size, boolean nullFill) Ensure that this WritableColumnSource can accept row keys in range[0, capacity).voidfillChunkUnordered(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Values> destination, @NotNull LongChunk<? extends RowKeys> keyIndices) Populates a contiguous portion of the given destination chunk with data corresponding to the keys from the givenLongChunk.voidfillPrevChunkUnordered(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Values> destination, @NotNull LongChunk<? extends RowKeys> keyIndices) Populates a contiguous portion of the given destination chunk with prev data corresponding to the keys from the givenLongChunk.protected abstract voidfillSparseChunk(@NotNull WritableChunk<? super Values> destination, @NotNull RowSequence indices) protected abstract voidfillSparseChunkUnordered(@NotNull WritableChunk<? super Values> destination, @NotNull LongChunk<? extends RowKeys> indices) protected abstract voidfillSparsePrevChunk(@NotNull WritableChunk<? super Values> destination, @NotNull RowSequence indices) protected abstract voidfillSparsePrevChunkUnordered(@NotNull WritableChunk<? super Values> destination, @NotNull LongChunk<? extends RowKeys> indices) static WritableColumnSource<?>static <T> WritableColumnSource<T>from(PrimitiveArray<T> array) static ArrayBackedColumnSource<Boolean>getBooleanMemoryColumnSource(@org.jetbrains.annotations.NotNull byte[] data) Produces an BooleanArraySource with the given data.getChunk(@NotNull ChunkSource.GetContext context, @NotNull RowSequence rowSequence) Returns a chunk of data corresponding to the keys from the givenRowSequence.static WritableColumnSource<Instant>getInstantMemoryColumnSource(@org.jetbrains.annotations.NotNull long[] data) Produces an InstantArraySource with the given data.static WritableColumnSource<Instant>Produces an InstantArraySource with the given data.static ArrayBackedColumnSource<Byte>getMemoryColumnSource(@org.jetbrains.annotations.NotNull byte[] data) Produces an ByteArraySource with the given data.static ArrayBackedColumnSource<Character>getMemoryColumnSource(@org.jetbrains.annotations.NotNull char[] data) Produces an CharacterArraySource with the given data.static ArrayBackedColumnSource<Double>getMemoryColumnSource(@org.jetbrains.annotations.NotNull double[] data) Produces an DoubleArraySource with the given data.static ArrayBackedColumnSource<Float>getMemoryColumnSource(@org.jetbrains.annotations.NotNull float[] data) Produces an FloatArraySource with the given data.static ArrayBackedColumnSource<Integer>getMemoryColumnSource(@org.jetbrains.annotations.NotNull int[] data) Produces an IntegerArraySource with the given data.static ArrayBackedColumnSource<Long>getMemoryColumnSource(@org.jetbrains.annotations.NotNull long[] data) Produces an LongArraySource with the given data.static ArrayBackedColumnSource<Short>getMemoryColumnSource(@org.jetbrains.annotations.NotNull short[] data) Produces an ShortArraySource with the given data.static <T> WritableColumnSource<T>getMemoryColumnSource(long size, @NotNull Class<T> dataType) Produces an empty ArrayBackedColumnSource with the given type and capacity.static <T> WritableColumnSource<T>getMemoryColumnSource(long size, @NotNull Class<T> dataType, @Nullable Class<?> componentType) Produces an empty ArrayBackedColumnSource with the given type and capacity.static <T> WritableColumnSource<T>getMemoryColumnSource(@NotNull Class<T> dataType, @Nullable Class<?> componentType) static <T> WritableColumnSource<T>getMemoryColumnSource(@NotNull Collection<T> data, @NotNull Class<T> dataType, @Nullable Class<?> componentType) Produces an ArrayBackedColumnSource with the given data.static <T> WritableColumnSource<T>getMemoryColumnSource(@NotNull T[] data, @NotNull Class<T> dataType, @Nullable Class<?> componentType) Produces an ArrayBackedColumnSource with the given data.static WritableColumnSource<?>getMemoryColumnSourceUntyped(@NotNull Object dataArray) Creates an in-memory ColumnSource from the supplied dataArray, using instanceof checks to determine the appropriate type of column source to produce.static <T> WritableColumnSource<T>getMemoryColumnSourceUntyped(@NotNull Object dataArray, @NotNull Class<T> dataType, @Nullable Class<?> componentType) Creates an in-memory ColumnSource from the supplied dataArray, using instanceof checks to determine the appropriate type of column source to produce.booleanDetermine if this column source is immutable, meaning that the values at a given row key never change.booleanReturns true if this column source can efficiently provide an unordered fill.voidset(long key, byte value) voidset(long key, char value) voidset(long key, double value) voidset(long key, float value) voidset(long key, int value) voidset(long key, long value) voidset(long key, short value) Methods inherited from class io.deephaven.engine.table.impl.AbstractColumnSource
allowsReinterpret, defaultFillChunk, defaultFillPrevChunk, doReinterpret, estimatePushdownFilterCost, fillChunk, fillPrevChunk, getComponentType, getPrevSource, getType, makePushdownFilterContext, match, pushdownFilter, pushdownManager, reinterpretMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.deephaven.engine.table.impl.sources.ChunkedBackingStoreExposedWritableSource
exposesChunkedBackingStore, resetWritableChunkToBackingStore, resetWritableChunkToBackingStoreSliceMethods inherited from interface io.deephaven.engine.table.ChunkSource
fillChunkMethods inherited from interface io.deephaven.engine.table.ChunkSource.WithPrev
fillPrevChunkMethods inherited from interface io.deephaven.engine.table.ColumnSource
allowsReinterpret, cast, cast, cast, cast, createPreviousTuple, createTuple, createTupleFromValues, exportAllTo, exportElement, exportElement, getChunkType, getComponentType, getPrevSource, getType, isStateless, match, reinterpret, releaseCachedResources, startTrackingPrevValues, tupleLengthMethods inherited from interface io.deephaven.engine.table.impl.DefaultChunkSource
getChunk, getChunkByFilling, makeFillContext, makeGetContextMethods inherited from interface io.deephaven.engine.table.impl.DefaultChunkSource.WithPrev
getPrevChunk, getPrevChunk, getPrevChunkByFillingMethods inherited from interface io.deephaven.engine.table.ElementSource
get, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getPrev, getPrevBoolean, getPrevByte, getPrevChar, getPrevDouble, getPrevFloat, getPrevInt, getPrevLong, getPrevShort, getShortMethods inherited from interface io.deephaven.engine.table.FillContextMaker
makeFillContextMethods inherited from interface io.deephaven.engine.table.GetContextMaker
makeGetContextMethods inherited from interface io.deephaven.engine.table.impl.sources.InMemoryColumnSource
isInMemoryMethods inherited from interface io.deephaven.engine.table.TupleExporter
exportAllReinterpretedTo, exportAllReinterpretedTo, exportAllTo, exportElementReinterpretedMethods inherited from interface io.deephaven.engine.table.TupleSource
createTupleFromReinterpretedValuesMethods inherited from interface io.deephaven.engine.table.WritableColumnSource
ensureCapacity, fillFromChunk, fillFromChunkUnordered, makeFillFromContext, set, setNull, setNull
-
Field Details
-
BLOCK_SIZE
public static final int BLOCK_SIZE- See Also:
-
-
Method Details
-
from
-
from
-
set
public void set(long key, byte value) - Specified by:
setin interfaceWritableColumnSource<T>
-
set
public void set(long key, char value) - Specified by:
setin interfaceWritableColumnSource<T>
-
set
public void set(long key, double value) - Specified by:
setin interfaceWritableColumnSource<T>
-
set
public void set(long key, float value) - Specified by:
setin interfaceWritableColumnSource<T>
-
set
public void set(long key, int value) - Specified by:
setin interfaceWritableColumnSource<T>
-
set
public void set(long key, long value) - Specified by:
setin interfaceWritableColumnSource<T>
-
set
public void set(long key, short value) - Specified by:
setin interfaceWritableColumnSource<T>
-
getMemoryColumnSource
public static <T> WritableColumnSource<T> getMemoryColumnSource(@NotNull @NotNull Collection<T> data, @NotNull @NotNull Class<T> dataType, @Nullable @Nullable Class<?> componentType) Produces an ArrayBackedColumnSource with the given data.- Parameters:
data- a collection containing the data to insert into the ColumnSource.dataType- the data type of the resulting column sourcecomponentType- the component type of the resulting column source- Returns:
- an in-memory column source with the requested data
-
getMemoryColumnSource
public static <T> WritableColumnSource<T> getMemoryColumnSource(@NotNull @NotNull T[] data, @NotNull @NotNull Class<T> dataType, @Nullable @Nullable Class<?> componentType) Produces an ArrayBackedColumnSource with the given data.- Parameters:
data- an array containing the data to insert into the ColumnSourcedataType- the data type of the resulting column sourcecomponentType- the component type of the resulting column source- Returns:
- an in-memory column source with the requested data
-
getMemoryColumnSource
public static ArrayBackedColumnSource<Byte> getMemoryColumnSource(@NotNull @org.jetbrains.annotations.NotNull byte[] data) Produces an ByteArraySource with the given data.- Parameters:
data- an array containing the data to insert into the ColumnSource.- Returns:
- an in-memory column source with the requested data
-
getBooleanMemoryColumnSource
public static ArrayBackedColumnSource<Boolean> getBooleanMemoryColumnSource(@NotNull @org.jetbrains.annotations.NotNull byte[] data) Produces an BooleanArraySource with the given data.- Parameters:
data- an array containing the data to insert into the ColumnSource.- Returns:
- an in-memory column source with the requested data
-
getMemoryColumnSource
public static ArrayBackedColumnSource<Character> getMemoryColumnSource(@NotNull @org.jetbrains.annotations.NotNull char[] data) Produces an CharacterArraySource with the given data.- Parameters:
data- an array containing the data to insert into the ColumnSource.- Returns:
- an in-memory column source with the requested data
-
getMemoryColumnSource
public static ArrayBackedColumnSource<Double> getMemoryColumnSource(@NotNull @org.jetbrains.annotations.NotNull double[] data) Produces an DoubleArraySource with the given data.- Parameters:
data- an array containing the data to insert into the ColumnSource.- Returns:
- an in-memory column source with the requested data
-
getMemoryColumnSource
public static ArrayBackedColumnSource<Float> getMemoryColumnSource(@NotNull @org.jetbrains.annotations.NotNull float[] data) Produces an FloatArraySource with the given data.- Parameters:
data- an array containing the data to insert into the ColumnSource.- Returns:
- an in-memory column source with the requested data
-
getMemoryColumnSource
public static ArrayBackedColumnSource<Integer> getMemoryColumnSource(@NotNull @org.jetbrains.annotations.NotNull int[] data) Produces an IntegerArraySource with the given data.- Parameters:
data- an array containing the data to insert into the ColumnSource.- Returns:
- an in-memory column source with the requested data
-
getMemoryColumnSource
public static ArrayBackedColumnSource<Long> getMemoryColumnSource(@NotNull @org.jetbrains.annotations.NotNull long[] data) Produces an LongArraySource with the given data.- Parameters:
data- an array containing the data to insert into the ColumnSource.- Returns:
- an in-memory column source with the requested data
-
getInstantMemoryColumnSource
Produces an InstantArraySource with the given data.- Parameters:
data- an array containing the data to insert into the ColumnSource, represented as long nanoseconds since the epoch- Returns:
- an in-memory column source with the requested data
-
getInstantMemoryColumnSource
public static WritableColumnSource<Instant> getInstantMemoryColumnSource(@NotNull @org.jetbrains.annotations.NotNull long[] data) Produces an InstantArraySource with the given data.- Parameters:
data- an array containing the data to insert into the ColumnSource, represented as long nanoseconds since the epoch- Returns:
- an in-memory column source with the requested data
-
getMemoryColumnSource
public static ArrayBackedColumnSource<Short> getMemoryColumnSource(@NotNull @org.jetbrains.annotations.NotNull short[] data) Produces an ShortArraySource with the given data.- Parameters:
data- an array containing the data to insert into the ColumnSource.- Returns:
- an in-memory column source with the requested data
-
getMemoryColumnSource
public static <T> WritableColumnSource<T> getMemoryColumnSource(long size, @NotNull @NotNull Class<T> dataType) Produces an empty ArrayBackedColumnSource with the given type and capacity.- Type Parameters:
T- the type parameter for the ColumnSource's type- Parameters:
size- the capacity of the returned column sourcedataType- the data type of the resultant column source- Returns:
- an in-memory column source of the requested type
-
getMemoryColumnSource
public static <T> WritableColumnSource<T> getMemoryColumnSource(@NotNull @NotNull Class<T> dataType, @Nullable @Nullable Class<?> componentType) -
getMemoryColumnSource
public static <T> WritableColumnSource<T> getMemoryColumnSource(long size, @NotNull @NotNull Class<T> dataType, @Nullable @Nullable Class<?> componentType) Produces an empty ArrayBackedColumnSource with the given type and capacity.- Type Parameters:
T- the type parameter for the ColumnSource's type- Parameters:
size- the capacity of the returned column sourcedataType- the data type of the resultant column sourcecomponentType- the component type for column sources of arrays or Vectors- Returns:
- an in-memory column source of the requested type
-
ensureCapacity
public abstract void ensureCapacity(long size, boolean nullFill) Description copied from interface:WritableColumnSourceEnsure that this WritableColumnSource can accept row keys in range[0, capacity).- Specified by:
ensureCapacityin interfaceWritableColumnSource<T>- Parameters:
size- The new minimum capacitynullFill- Whether data should be "null-filled". If true, get operations at row keys that have not been set will return the appropriate null value; otherwise such gets produce undefined results.
-
getMemoryColumnSourceUntyped
public static WritableColumnSource<?> getMemoryColumnSourceUntyped(@NotNull @NotNull Object dataArray) Creates an in-memory ColumnSource from the supplied dataArray, using instanceof checks to determine the appropriate type of column source to produce.- Parameters:
dataArray- the data to insert into the new column source- Returns:
- a ColumnSource with the supplied data.
-
getMemoryColumnSourceUntyped
public static <T> WritableColumnSource<T> getMemoryColumnSourceUntyped(@NotNull @NotNull Object dataArray, @NotNull @NotNull Class<T> dataType, @Nullable @Nullable Class<?> componentType) Creates an in-memory ColumnSource from the supplied dataArray, using instanceof checks to determine the appropriate type of column source to produce.- Parameters:
dataArray- the data to insert into the new column sourcedataType- the data type of the resultant column sourcecomponentType- the component type for column sources of arrays or Vectors- Returns:
- a ColumnSource with the supplied data.
-
isImmutable
public boolean isImmutable()Description copied from interface:ColumnSourceDetermine if this column source is immutable, meaning that the values at a given row key never change.- Specified by:
isImmutablein interfaceColumnSource<T>- Returns:
- true if the values at a given row key of the column source never change, false otherwise
-
fillChunkUnordered
public void fillChunkUnordered(@NotNull @NotNull ChunkSource.FillContext context, @NotNull @NotNull WritableChunk<? super Values> destination, @NotNull @NotNull LongChunk<? extends RowKeys> keyIndices) Description copied from interface:FillUnorderedPopulates a contiguous portion of the given destination chunk with data corresponding to the keys from the givenLongChunk.It behaves as if the following code were executed:
destination.setSize(keys.size()); for (int ii = 0; ii < keys.size(); ++ii) { destination.set(ii, get(keys.get(ii))); }- Specified by:
fillChunkUnorderedin interfaceFillUnordered<T>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk.destination- The chunk to be populated according tokeyskeyIndices- A chunk of individual, not assumed to be ordered keys to be fetched
-
fillPrevChunkUnordered
public void fillPrevChunkUnordered(@NotNull @NotNull ChunkSource.FillContext context, @NotNull @NotNull WritableChunk<? super Values> destination, @NotNull @NotNull LongChunk<? extends RowKeys> keyIndices) Description copied from interface:FillUnorderedPopulates a contiguous portion of the given destination chunk with prev data corresponding to the keys from the givenLongChunk.It behaves as if the following code were executed:
destination.setSize(keys.size()); for (int ii = 0; ii < keys.size(); ++ii) { destination.set(ii, getPrev(keys.get(ii))); }- Specified by:
fillPrevChunkUnorderedin interfaceFillUnordered<T>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk.destination- The chunk to be populated according tokeyskeyIndices- A chunk of individual, not assumed to be ordered keys to be fetched
-
fillSparseChunk
protected abstract void fillSparseChunk(@NotNull @NotNull WritableChunk<? super Values> destination, @NotNull @NotNull RowSequence indices) -
fillSparsePrevChunk
protected abstract void fillSparsePrevChunk(@NotNull @NotNull WritableChunk<? super Values> destination, @NotNull @NotNull RowSequence indices) -
fillSparseChunkUnordered
protected abstract void fillSparseChunkUnordered(@NotNull @NotNull WritableChunk<? super Values> destination, @NotNull @NotNull LongChunk<? extends RowKeys> indices) -
fillSparsePrevChunkUnordered
protected abstract void fillSparsePrevChunkUnordered(@NotNull @NotNull WritableChunk<? super Values> destination, @NotNull @NotNull LongChunk<? extends RowKeys> indices) -
getChunk
public Chunk<Values> getChunk(@NotNull @NotNull ChunkSource.GetContext context, @NotNull @NotNull RowSequence rowSequence) Description copied from interface:ChunkSourceReturns a chunk of data corresponding to the keys from the givenRowSequence.- Specified by:
getChunkin interfaceChunkSource<T>- Specified by:
getChunkin interfaceDefaultChunkSource<T>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk. In particular, the Context may be used to provide a Chunk data poolrowSequence- AnRowSequencerepresenting the keys to be fetched- Returns:
- A chunk of data corresponding to the keys from the given
RowSequence
-
providesFillUnordered
public boolean providesFillUnordered()Description copied from interface:FillUnorderedReturns true if this column source can efficiently provide an unordered fill. If this method returns false, then fillChunkUnordered and fillPrevChunkUnordered may throw an UnsupportedOperationException.- Specified by:
providesFillUnorderedin interfaceFillUnordered<T>- Returns:
- if this column source can provide an unordered fill
-