Package com.illumon.iris.db.v2.sources
Class ShortArraySource
java.lang.Object
com.illumon.iris.db.v2.sources.AbstractColumnSource<T>
com.illumon.iris.db.v2.sources.ArrayBackedColumnSource<T>
com.illumon.iris.db.v2.sources.ShortArraySource
- All Implemented Interfaces:
ChunkSource<Attributes.Values>,ChunkSource.WithPrev<Attributes.Values>,DefaultChunkSource<Attributes.Values>,DefaultChunkSource.WithPrev<Attributes.Values>,FillContextMaker,GetContextMaker,ColumnSource<Short>,ColumnSourceGetDefaults.ForShort,ElementSource<Short>,FillUnordered,MutableColumnSource<Short>,MutableColumnSourceGetDefaults.ForShort,Releasable,WritableChunkSink<Attributes.Values>,WritableSource<Short>,TupleExporter<Short>,TupleSource<Short>,ShiftData.ShiftCallback,Serializable
public class ShortArraySource
extends ArrayBackedColumnSource<T>
implements MutableColumnSourceGetDefaults.ForShort
Simple array source for Short.
The C-haracterArraySource is replicated to all other types with com.illumon.iris.db.v2.sources.Replicate. (C-haracter is deliberately spelled that way in order to prevent Replicate from altering this very comment).
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.illumon.iris.db.v2.sources.AbstractColumnSource
AbstractColumnSource.DefaultedImmutable<DATA_TYPE>, AbstractColumnSource.DefaultedMutable<DATA_TYPE>, AbstractColumnSource.IsSerializableNested classes/interfaces inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource
ChunkSource.FillContext, ChunkSource.GetContext, ChunkSource.WithPrev<ATTR extends Attributes.Any>Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource
DefaultChunkSource.SupportsContiguousGet<ATTR extends Attributes.Any>, DefaultChunkSource.WithPrev<ATTR extends Attributes.Any>Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.sources.WritableChunkSink
WritableChunkSink.FillFromContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected UpdateCommitter<com.illumon.iris.db.v2.sources.ArraySourceHelper<Short,short[]>> The presence of a prevFlusher means that this ArraySource wants to track previous values.Fields inherited from class com.illumon.iris.db.v2.sources.ArrayBackedColumnSource
BLOCK_SIZEFields inherited from class com.illumon.iris.db.v2.sources.AbstractColumnSource
componentType, typeFields inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource
DEFAULT_FILL_INSTANCE, ZERO_LENGTH_CHUNK_SOURCE_ARRAYFields inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource.WithPrev
ZERO_LENGTH_CHUNK_SOURCE_WITH_PREV_ARRAYFields inherited from interface com.illumon.iris.db.v2.sources.ColumnSource
ZERO_LENGTH_COLUMN_SOURCE_ARRAYFields inherited from interface com.illumon.iris.db.v2.sources.WritableChunkSink
DEFAULT_FILL_FROM_INSTANCEFields inherited from interface com.illumon.iris.db.v2.sources.WritableSource
ZERO_LENGTH_WRITABLE_SOURCE_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcopy(ColumnSource<Short> sourceColumn, long sourceKey, long destKey) voidcopyFromChunk(long firstKey, long totalLength, Chunk<? extends Attributes.Values> src, int offset) voidensureCapacity(long capacity) voidensureCapacity(long capacity, boolean nullFill) voidfillFromChunk(WritableChunkSink.FillFromContext context, Chunk<? extends Attributes.Values> src, OrderedKeys orderedKeys) Our default, inefficient, implementation.voidfillFromChunkUnordered(WritableChunkSink.FillFromContext context, Chunk<? extends Attributes.Values> src, LongChunk<Attributes.KeyIndices> keys) Fills the ChunkSink with data from the source, with data corresponding to the keys from the given key chunk.voidfillPrevChunk(ChunkSource.FillContext context, WritableChunk<? super Attributes.Values> destination, OrderedKeys orderedKeys) Populates the given destination chunk with data corresponding to the keys from the givenOrderedKeys.protected voidfillSparseChunk(WritableChunk<? super Attributes.Values> destGeneric, OrderedKeys indices) protected voidfillSparseChunkUnordered(WritableChunk<? super Attributes.Values> destGeneric, LongChunk<? extends Attributes.KeyIndices> indices) protected voidfillSparsePrevChunk(WritableChunk<? super Attributes.Values> destGeneric, OrderedKeys indices) protected voidfillSparsePrevChunkUnordered(WritableChunk<? super Attributes.Values> destGeneric, LongChunk<? extends Attributes.KeyIndices> indices) get(long index) Get the value from the source.final shortgetAndSetUnsafe(long index, short newValue) final longGet the capacity of this column source.getPrev(long index) Get the previous value at the index.final shortgetPrevShort(long index) Get the previous value at the index as a short.final shortgetShort(long index) Get the value at the index as a short.final shortgetUnsafe(long index) makeFillContext(int chunkCapacity, SharedContext sharedContext) Allocate a newChunkSource.FillContextfor filling chunks from thisFillContextMaker, typically aChunkSource.makeFillFromContext(int chunkCapacity) Provide a default, emptyWritableChunkSink.FillFromContextfor use with our defaultWritableSource.fillFromChunk(com.illumon.iris.db.v2.sources.WritableChunkSink.FillFromContext, com.illumon.iris.db.v2.sources.chunk.Chunk<? extends com.illumon.iris.db.v2.sources.chunk.Attributes.Values>, com.illumon.iris.db.v2.utils.OrderedKeys).voidmove(long source, long dest, long length) longresetWritableChunkToBackingStore(ResettableWritableChunk chunk, long position) Resets the given chunk to provide a write-through reference to our backing array.final voidset(long key, short value) final voidvoidsetNull(long key) voidshift(long start, long end, long offset) voidForce my inheritors to implement this method, rather than taking the interface default.Methods inherited from class com.illumon.iris.db.v2.sources.ArrayBackedColumnSource
fillChunk, fillChunkUnordered, fillPrevChunkUnordered, getChunk, getDateTimeMemoryColumnSource, getDateTimeMemoryColumnSource, getImmutableMemoryColumnSource, getImmutableMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, getMemoryColumnSource, isImmutable, set, set, set, set, set, setMethods inherited from class com.illumon.iris.db.v2.sources.AbstractColumnSource
allowsReinterpret, canUseGrouping, defaultFillChunk, doReinterpret, getComponentType, getGroupingBuilder, getGroupingProvider, getNativeType, getType, hasGrouping, hasGrouping, isSerializable, match, matchWithGrouping, reinterpret, setGroupingProviderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource
fillChunk, getChunkTypeMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource.WithPrev
fillPrevChunkMethods inherited from interface com.illumon.iris.db.v2.sources.ColumnSource
allowsReinterpret, cast, createPreviousTuple, createTuple, createTupleFromValues, exportElement, exportElement, exportToExternalKey, getColumnSources, getComponentType, getGroupingBuilder, getGroupingProvider, getNativeType, getPrevSource, getType, hasGrouping, hasGrouping, match, reinterpret, releaseCachedResources, setGroupingProviderMethods inherited from interface com.illumon.iris.db.v2.sources.ColumnSourceGetDefaults.ForShort
getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLongMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource
getChunk, getChunk, getChunkByFilling, makeFillContext, makeGetContextMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource.WithPrev
getPrevChunk, getPrevChunk, getPrevChunkByFillingMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.FillContextMaker
makeFillContextMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.GetContextMaker
makeGetContextMethods inherited from interface com.illumon.iris.db.v2.sources.MutableColumnSource
isImmutableMethods inherited from interface com.illumon.iris.db.v2.sources.MutableColumnSourceGetDefaults.ForShort
getPrevBoolean, getPrevByte, getPrevChar, getPrevDouble, getPrevFloat, getPrevInt, getPrevLongMethods inherited from interface com.illumon.iris.db.v2.tuples.TupleExporter
exportElementReinterpretedMethods inherited from interface com.illumon.iris.db.v2.tuples.TupleSource
createTupleFromReinterpretedValuesMethods inherited from interface com.illumon.iris.db.v2.sources.WritableSource
setNull
-
Field Details
-
prevFlusher
protected transient UpdateCommitter<com.illumon.iris.db.v2.sources.ArraySourceHelper<Short,short[]>> prevFlusherThe presence of a prevFlusher means that this ArraySource wants to track previous values. If prevFlusher is null, the ArraySource does not want (or does not yet want) to track previous values. Deserialized ArraySources never track previous values.
-
-
Constructor Details
-
ShortArraySource
public ShortArraySource()
-
-
Method Details
-
startTrackingPrevValues
public void startTrackingPrevValues()Force my inheritors to implement this method, rather than taking the interface default.- Specified by:
startTrackingPrevValuesin interfaceColumnSource<Short>
-
ensureCapacity
public void ensureCapacity(long capacity) - Specified by:
ensureCapacityin interfaceWritableSource<Short>
-
ensureCapacity
public void ensureCapacity(long capacity, boolean nullFill) - Specified by:
ensureCapacityin classArrayBackedColumnSource<Short>
-
set
- Specified by:
setin interfaceWritableSource<Short>
-
set
public final void set(long key, short value) - Specified by:
setin interfaceWritableSource<Short>- Overrides:
setin classArrayBackedColumnSource<Short>
-
setNull
public void setNull(long key) - Specified by:
setNullin interfaceWritableSource<Short>
-
get
Description copied from interface:ElementSourceGet the value from the source. This may return boxed values for basic types.- Specified by:
getin interfaceColumnSourceGetDefaults.ForShort- Specified by:
getin interfaceElementSource<Short>- Parameters:
index- the location in index space to get the value from.- Returns:
- the value at the index, potentially null.
-
getShort
public final short getShort(long index) Description copied from interface:ElementSourceGet the value at the index as a short.- Specified by:
getShortin interfaceElementSource<Short>- Parameters:
index- the location in index space to get the value from.- Returns:
- the short at the index, null values are represented by
QueryConstants.NULL_SHORT
-
getUnsafe
public final short getUnsafe(long index) -
getAndSetUnsafe
public final short getAndSetUnsafe(long index, short newValue) -
getPrev
Description copied from interface:ElementSourceGet the previous value at the index. Previous values are used during anLTMupdatecycle to process changes in data. Duringnormaloperation previous values will be identical tocurrentvalues.- Specified by:
getPrevin interfaceElementSource<Short>- Specified by:
getPrevin interfaceMutableColumnSourceGetDefaults.ForShort- Parameters:
index- the location in index space to get the value from.- Returns:
- the previous value at the index, or null.
-
getPrevShort
public final short getPrevShort(long index) Description copied from interface:ElementSourceGet the previous value at the index as a short. SeeElementSource.getPrev(long)for more details.- Specified by:
getPrevShortin interfaceElementSource<Short>- Parameters:
index- the location in index space to get the previous value from.- Returns:
- the previous short at the index, null values are represented by
QueryConstants.NULL_SHORT
-
copy
- Specified by:
copyin interfaceWritableSource<Short>
-
shift
public void shift(long start, long end, long offset) - Specified by:
shiftin interfaceShiftData.ShiftCallback- Overrides:
shiftin classArrayBackedColumnSource<Short>
-
move
public void move(long source, long dest, long length) -
resetWritableChunkToBackingStore
Description copied from class:ArrayBackedColumnSourceResets the given chunk to provide a write-through reference to our backing array. Note: This is unsafe to use if previous tracking has been enabled!- Specified by:
resetWritableChunkToBackingStorein classArrayBackedColumnSource<Short>- Parameters:
chunk- the writable chunk to reset to our backing array.position- position that we require- Returns:
- the first position addressable by the chunk
-
fillSparseChunk
protected void fillSparseChunk(@NotNull WritableChunk<? super Attributes.Values> destGeneric, @NotNull OrderedKeys indices) - Specified by:
fillSparseChunkin classArrayBackedColumnSource<Short>
-
fillSparsePrevChunk
protected void fillSparsePrevChunk(@NotNull WritableChunk<? super Attributes.Values> destGeneric, @NotNull OrderedKeys indices) - Specified by:
fillSparsePrevChunkin classArrayBackedColumnSource<Short>
-
fillSparseChunkUnordered
protected void fillSparseChunkUnordered(@NotNull WritableChunk<? super Attributes.Values> destGeneric, @NotNull LongChunk<? extends Attributes.KeyIndices> indices) - Specified by:
fillSparseChunkUnorderedin classArrayBackedColumnSource<Short>
-
fillSparsePrevChunkUnordered
protected void fillSparsePrevChunkUnordered(@NotNull WritableChunk<? super Attributes.Values> destGeneric, @NotNull LongChunk<? extends Attributes.KeyIndices> indices) - Specified by:
fillSparsePrevChunkUnorderedin classArrayBackedColumnSource<Short>
-
copyFromChunk
public void copyFromChunk(long firstKey, long totalLength, Chunk<? extends Attributes.Values> src, int offset) -
fillFromChunkUnordered
public void fillFromChunkUnordered(@NotNull WritableChunkSink.FillFromContext context, @NotNull Chunk<? extends Attributes.Values> src, @NotNull LongChunk<Attributes.KeyIndices> keys) Description copied from interface:WritableChunkSinkFills the ChunkSink with data from the source, with data corresponding to the keys from the given key chunk.- Specified by:
fillFromChunkUnorderedin interfaceWritableChunkSink<Attributes.Values>- Specified by:
fillFromChunkUnorderedin interfaceWritableSource<Short>- Parameters:
context- A context containing all mutable/state related data used in writing the Chunk.src- The source of the dataorderedKeyskeys- ALongChunkrepresenting the keys to be written
-
fillPrevChunk
public void fillPrevChunk(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Attributes.Values> destination, @NotNull OrderedKeys orderedKeys) Description copied from interface:ChunkSource.WithPrevPopulates the given destination chunk with data corresponding to the keys from the givenOrderedKeys.- Specified by:
fillPrevChunkin interfaceChunkSource.WithPrev<T>- Overrides:
fillPrevChunkin classAbstractColumnSource<T>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk.destination- The chunk to be populated according toorderedKeys. No assumptions shall be made about the size of the chunk shall be made. The chunk will be populated from position [0,orderedKeys.size()).orderedKeys- AnOrderedKeysrepresenting the keys to be fetched
-
getCapacity
public final long getCapacity()Get the capacity of this column source. This number is one higher than the highest key that may be accessed (read or written).- Returns:
- The capacity of this column source
-
makeFillFromContext
Description copied from interface:WritableSourceProvide a default, emptyWritableChunkSink.FillFromContextfor use with our defaultWritableSource.fillFromChunk(com.illumon.iris.db.v2.sources.WritableChunkSink.FillFromContext, com.illumon.iris.db.v2.sources.chunk.Chunk<? extends com.illumon.iris.db.v2.sources.chunk.Attributes.Values>, com.illumon.iris.db.v2.utils.OrderedKeys). -
fillFromChunk
public void fillFromChunk(@NotNull WritableChunkSink.FillFromContext context, @NotNull Chunk<? extends Attributes.Values> src, @NotNull OrderedKeys orderedKeys) Description copied from interface:WritableSourceOur default, inefficient, implementation. Inheritors who care should provide a better implementation.- Parameters:
context- A context containing all mutable/state related data used in writing the Chunk.src- The source of the dataorderedKeysorderedKeys- AnOrderedKeysrepresenting the keys to be written
-