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>
,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.FillFromContext
Nested 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
Fields inherited from class io.deephaven.engine.table.impl.AbstractColumnSource
componentType, type, updateGraph, USE_RANGES_AVERAGE_RUN_LENGTH
Fields inherited from interface io.deephaven.engine.table.ChunkSink
DEFAULT_FILL_FROM_INSTANCE
Fields inherited from interface io.deephaven.engine.table.ChunkSource
DEFAULT_FILL_INSTANCE, ZERO_LENGTH_CHUNK_SOURCE_ARRAY
Fields inherited from interface io.deephaven.engine.table.ChunkSource.WithPrev
ZERO_LENGTH_CHUNK_SOURCE_WITH_PREV_ARRAY
Fields inherited from interface io.deephaven.engine.table.ColumnSource
ZERO_LENGTH_COLUMN_SOURCE_ARRAY
Fields inherited from interface io.deephaven.engine.table.impl.sources.InMemoryColumnSource
TWO_DIMENSIONAL_COLUMN_SOURCE_THRESHOLD
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
ensureCapacity
(long size, boolean nullFill) Ensure that this WritableColumnSource can accept row keys in range[0, capacity)
.void
fillChunkUnordered
(@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
.void
fillPrevChunkUnordered
(@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 void
fillSparseChunk
(@NotNull WritableChunk<? super Values> destination, @NotNull RowSequence indices) protected abstract void
fillSparseChunkUnordered
(@NotNull WritableChunk<? super Values> destination, @NotNull LongChunk<? extends RowKeys> indices) protected abstract void
fillSparsePrevChunk
(@NotNull WritableChunk<? super Values> destination, @NotNull RowSequence indices) protected abstract void
fillSparsePrevChunkUnordered
(@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.boolean
Determine if this column source is immutable, meaning that the values at a given row key never change.boolean
Returns true if this column source can efficiently provide an unordered fill.void
set
(long key, byte value) void
set
(long key, char value) void
set
(long key, double value) void
set
(long key, float value) void
set
(long key, int value) void
set
(long key, long value) void
set
(long key, short value) Methods inherited from class io.deephaven.engine.table.impl.AbstractColumnSource
allowsReinterpret, defaultFillChunk, defaultFillPrevChunk, doReinterpret, fillChunk, fillPrevChunk, getComponentType, getPrevSource, getType, match, reinterpret
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.deephaven.engine.table.impl.sources.ChunkedBackingStoreExposedWritableSource
exposesChunkedBackingStore, resetWritableChunkToBackingStore, resetWritableChunkToBackingStoreSlice
Methods inherited from interface io.deephaven.engine.table.ChunkSource
fillChunk
Methods inherited from interface io.deephaven.engine.table.ChunkSource.WithPrev
fillPrevChunk
Methods 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, tupleLength
Methods inherited from interface io.deephaven.engine.table.impl.DefaultChunkSource
getChunk, getChunkByFilling, makeFillContext, makeGetContext
Methods inherited from interface io.deephaven.engine.table.impl.DefaultChunkSource.WithPrev
getPrevChunk, getPrevChunk, getPrevChunkByFilling
Methods 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, getShort
Methods inherited from interface io.deephaven.engine.table.FillContextMaker
makeFillContext
Methods inherited from interface io.deephaven.engine.table.GetContextMaker
makeGetContext
Methods inherited from interface io.deephaven.engine.table.impl.sources.InMemoryColumnSource
isInMemory
Methods inherited from interface io.deephaven.engine.table.TupleExporter
exportAllReinterpretedTo, exportAllReinterpretedTo, exportAllTo, exportElementReinterpreted
Methods inherited from interface io.deephaven.engine.table.TupleSource
createTupleFromReinterpretedValues
Methods 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:
set
in interfaceWritableColumnSource<T>
-
set
public void set(long key, char value) - Specified by:
set
in interfaceWritableColumnSource<T>
-
set
public void set(long key, double value) - Specified by:
set
in interfaceWritableColumnSource<T>
-
set
public void set(long key, float value) - Specified by:
set
in interfaceWritableColumnSource<T>
-
set
public void set(long key, int value) - Specified by:
set
in interfaceWritableColumnSource<T>
-
set
public void set(long key, long value) - Specified by:
set
in interfaceWritableColumnSource<T>
-
set
public void set(long key, short value) - Specified by:
set
in 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:WritableColumnSource
Ensure that this WritableColumnSource can accept row keys in range[0, capacity)
.- Specified by:
ensureCapacity
in 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:ColumnSource
Determine if this column source is immutable, meaning that the values at a given row key never change.- Specified by:
isImmutable
in 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:FillUnordered
Populates 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:
fillChunkUnordered
in interfaceFillUnordered<T>
- Parameters:
context
- A context containing all mutable/state related data used in retrieving the Chunk.destination
- The chunk to be populated according tokeys
keyIndices
- 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:FillUnordered
Populates 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:
fillPrevChunkUnordered
in interfaceFillUnordered<T>
- Parameters:
context
- A context containing all mutable/state related data used in retrieving the Chunk.destination
- The chunk to be populated according tokeys
keyIndices
- 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:ChunkSource
Returns a chunk of data corresponding to the keys from the givenRowSequence
.- Specified by:
getChunk
in interfaceChunkSource<T>
- Specified by:
getChunk
in 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
- AnRowSequence
representing 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:FillUnordered
Returns 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:
providesFillUnordered
in interfaceFillUnordered<T>
- Returns:
- if this column source can provide an unordered fill
-