Package com.illumon.iris.db.v2.sources
Class LongSparseArraySource
java.lang.Object
com.illumon.iris.db.v2.sources.AbstractColumnSource<T>
com.illumon.iris.db.v2.sources.SparseArrayColumnSource<Long>
com.illumon.iris.db.v2.sources.LongSparseArraySource
- All Implemented Interfaces:
ChunkSource<Attributes.Values>,ChunkSource.WithPrev<Attributes.Values>,DefaultChunkSource<Attributes.Values>,DefaultChunkSource.WithPrev<Attributes.Values>,FillContextMaker,GetContextMaker,ColumnSource<Long>,ColumnSourceGetDefaults.ForLong,ColumnSourceGetDefaults.LongBacked<Long>,ConvertableTimeSource,ElementSource<Long>,FillUnordered,MutableColumnSource<Long>,MutableColumnSourceGetDefaults.ForLong,MutableColumnSourceGetDefaults.LongBacked<Long>,Releasable,WritableChunkSink<Attributes.Values>,WritableSource<Long>,TupleExporter<Long>,TupleSource<Long>,Serializable
public class LongSparseArraySource
extends SparseArrayColumnSource<Long>
implements MutableColumnSourceGetDefaults.ForLong, ConvertableTimeSource
Sparse array source for Long.
The C-haracterSparseArraySource 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.SparseArrayColumnSource
SparseArrayColumnSource.FillByContext<UArray>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.ConvertableTimeSource
ConvertableTimeSource.ZonedNested 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 LongOneOrN.Block0protected LongOneOrN.Block0protected UpdateCommitter<LongSparseArraySource>The presence of a prevFlusher means that this ArraySource wants to track previous values.Fields inherited from class com.illumon.iris.db.v2.sources.SparseArrayColumnSource
ZERO_LENGTH_SPARSE_ARRAY_COLUMN_SOURCE_ARRAYFields 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 TypeMethodDescription<ALTERNATE_DATA_TYPE>
booleanallowsReinterpret(Class<ALTERNATE_DATA_TYPE> alternateDataType) Test if a reinterpret call will succeed.voidcopy(ColumnSource<Long> sourceColumn, long sourceKey, long destKey) protected <ALTERNATE_DATA_TYPE>
ColumnSource<ALTERNATE_DATA_TYPE>doReinterpret(Class<ALTERNATE_DATA_TYPE> alternateDataType) Supply allowed reinterpret results.voidensureCapacity(long capacity) 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.<R> voidfillFromChunkUnordered(WritableChunkSink.FillFromContext context, Chunk<? extends Attributes.Values> src, LongChunk<Attributes.KeyIndices> keys, ToLongFunction<R> converter) voidfillPrevChunk(ChunkSource.FillContext context, WritableChunk<? super Attributes.Values> dest, OrderedKeys orderedKeys) Populates the given destination chunk with data corresponding to the keys from the givenOrderedKeys.get(long index) Get the value from the source.getChunk(ChunkSource.GetContext context, OrderedKeys orderedKeys) Returns a chunk of data corresponding to the keys from the givenOrderedKeys.final longgetLong(long index) Get the value at the index as a long.getPrev(long index) Get the previous value at the index.getPrevChunk(ChunkSource.GetContext context, OrderedKeys orderedKeys) Returns a chunk of previous data corresponding to the keys from the givenOrderedKeys.final longgetPrevLong(long index) Get the previous value at the index as a long.final voidset(long key, long value) voidvoidsetNull(long key) voidshift(ReadOnlyIndex keysToShift, long shiftDelta) voidColumnSource implementations that track previous values have the option to not actually start tracking previous values until this method is called.booleanCheck if this class supports time conversion.Convert this source to aDBDateTimesource.Convert this source to alongsource of nanoseconds of epoch.Convert this source to anInstantsource.toLocalDate(ZoneId zone) toLocalTime(ZoneId zone) toZonedDateTime(ZoneId zone) Convert this source to aZonedDateTimesource at the specifiedzone.Methods inherited from class com.illumon.iris.db.v2.sources.SparseArrayColumnSource
fillChunk, fillChunkUnordered, fillFromChunk, fillPrevChunkUnordered, getDateTimeMemoryColumnSource, getPreferredChunkSize, getSparseMemoryColumnSource, getSparseMemoryColumnSource, getSparseMemoryColumnSource, getSparseMemoryColumnSource, getSparseMemoryColumnSource, getSparseMemoryColumnSource, getSparseMemoryColumnSource, getSparseMemoryColumnSource, getSparseMemoryColumnSource, getSparseMemoryColumnSource, getSparseMemoryColumnSource, getSparseMemoryColumnSource, getSparseMemoryColumnSource, isImmutable, makeFillFromContext, remove, set, set, set, set, set, set, setImmutable, setNullMethods inherited from class com.illumon.iris.db.v2.sources.AbstractColumnSource
canUseGrouping, defaultFillChunk, 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.ColumnSource
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.LongBacked
getBoolean, getByte, getChar, getDouble, getFloat, getInt, getShortMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource
getChunk, getChunkByFilling, makeFillContext, makeGetContextMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource.WithPrev
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.LongBacked
getPrevBoolean, getPrevByte, getPrevChar, getPrevDouble, getPrevFloat, getPrevInt, getPrevShortMethods inherited from interface com.illumon.iris.db.v2.tuples.TupleExporter
exportElementReinterpretedMethods inherited from interface com.illumon.iris.db.v2.tuples.TupleSource
createTupleFromReinterpretedValues
-
Field Details
-
prevFlusher
The 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. -
blocks
-
prevBlocks
-
-
Constructor Details
-
LongSparseArraySource
public LongSparseArraySource()
-
-
Method Details
-
ensureCapacity
public void ensureCapacity(long capacity) - Specified by:
ensureCapacityin interfaceWritableSource<Long>
-
setNull
public void setNull(long key) - Specified by:
setNullin interfaceWritableSource<Long>
-
set
public final void set(long key, long value) - Specified by:
setin interfaceWritableSource<Long>- Overrides:
setin classSparseArrayColumnSource<Long>
-
shift
- Overrides:
shiftin classSparseArrayColumnSource<Long>
-
set
- Specified by:
setin interfaceWritableSource<Long>
-
get
Description copied from interface:ElementSourceGet the value from the source. This may return boxed values for basic types.- Specified by:
getin interfaceColumnSourceGetDefaults.ForLong- Specified by:
getin interfaceElementSource<Long>- Parameters:
index- the location in index space to get the value from.- Returns:
- the value at the index, potentially null.
-
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<Long>- Specified by:
getPrevin interfaceMutableColumnSourceGetDefaults.ForLong- Parameters:
index- the location in index space to get the value from.- Returns:
- the previous value at the index, or null.
-
copy
- Specified by:
copyin interfaceWritableSource<Long>
-
getLong
public final long getLong(long index) Description copied from interface:ElementSourceGet the value at the index as a long.- Specified by:
getLongin interfaceElementSource<Long>- Parameters:
index- the location in index space to get the value from.- Returns:
- the long at the index, null values are represented by
QueryConstants.NULL_LONG
-
getPrevLong
public final long getPrevLong(long index) Description copied from interface:ElementSourceGet the previous value at the index as a long. SeeElementSource.getPrev(long)for more details.- Specified by:
getPrevLongin interfaceElementSource<Long>- Parameters:
index- the location in index space to get the previous value from.- Returns:
- the previous long at the index, null values are represented by
QueryConstants.NULL_LONG
-
startTrackingPrevValues
public void startTrackingPrevValues()Description copied from interface:ColumnSourceColumnSource implementations that track previous values have the option to not actually start tracking previous values until this method is called. This is an option, not an obligation: some simple ColumnSource implementations (like TSingleValueSource for various T) always track previous values; other implementations (like PrevColumnSource) never do; some (like TArrayColumnSource) only start tracking once this method is called. An immutable column source can not have distinct prev values; therefore it is implemented as a no-op.- Specified by:
startTrackingPrevValuesin interfaceColumnSource<Long>
-
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<Long>- 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
-
fillFromChunkUnordered
public <R> void fillFromChunkUnordered(@NotNull WritableChunkSink.FillFromContext context, @NotNull Chunk<? extends Attributes.Values> src, @NotNull LongChunk<Attributes.KeyIndices> keys, ToLongFunction<R> converter) -
fillPrevChunk
public void fillPrevChunk(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Attributes.Values> dest, @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<Attributes.Values>- Overrides:
fillPrevChunkin classAbstractColumnSource<Long>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk.dest- 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
-
getChunk
public LongChunk<Attributes.Values> getChunk(@NotNull ChunkSource.GetContext context, @NotNull OrderedKeys orderedKeys) Description copied from interface:ChunkSourceReturns a chunk of data corresponding to the keys from the givenOrderedKeys.- Specified by:
getChunkin interfaceChunkSource<Attributes.Values>- Specified by:
getChunkin interfaceDefaultChunkSource<Attributes.Values>- 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 poolorderedKeys- AnOrderedKeysrepresenting the keys to be fetched- Returns:
- A chunk of data corresponding to the keys from the given
OrderedKeys
-
getPrevChunk
public LongChunk<Attributes.Values> getPrevChunk(@NotNull ChunkSource.GetContext context, @NotNull OrderedKeys orderedKeys) Description copied from interface:ChunkSource.WithPrevReturns a chunk of previous data corresponding to the keys from the givenOrderedKeys.- Specified by:
getPrevChunkin interfaceChunkSource.WithPrev<Attributes.Values>- Specified by:
getPrevChunkin interfaceDefaultChunkSource.WithPrev<Attributes.Values>- 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 poolorderedKeys- AnOrderedKeysrepresenting the keys to be fetched- Returns:
- A chunk of data corresponding to the keys from the given
OrderedKeys.
-
allowsReinterpret
public <ALTERNATE_DATA_TYPE> boolean allowsReinterpret(@NotNull Class<ALTERNATE_DATA_TYPE> alternateDataType) Description copied from interface:ColumnSourceTest if a reinterpret call will succeed.- Specified by:
allowsReinterpretin interfaceColumnSource<Long>- Overrides:
allowsReinterpretin classAbstractColumnSource<Long>- Type Parameters:
ALTERNATE_DATA_TYPE- the dataType to inquire about- Parameters:
alternateDataType- The alternative type to consider- Returns:
- If a reinterpret on this column source with the supplied alternateDataType will succeed.
-
doReinterpret
protected <ALTERNATE_DATA_TYPE> ColumnSource<ALTERNATE_DATA_TYPE> doReinterpret(@NotNull Class<ALTERNATE_DATA_TYPE> alternateDataType) Description copied from class:AbstractColumnSourceSupply allowed reinterpret results. The default implementation handles the most common case to avoid code duplication.- Overrides:
doReinterpretin classAbstractColumnSource<Long>- Type Parameters:
ALTERNATE_DATA_TYPE- the dataType to reinterpret to- Parameters:
alternateDataType- The alternate data type- Returns:
- The resulting
ColumnSource
-
supportsTimeConversion
public boolean supportsTimeConversion()Description copied from interface:ConvertableTimeSourceCheck if this class supports time conversion. If false, all other methods will fail.- Specified by:
supportsTimeConversionin interfaceConvertableTimeSource- Returns:
- true if time conversion is supported.
-
toZonedDateTime
Description copied from interface:ConvertableTimeSourceConvert this source to aZonedDateTimesource at the specifiedzone.- Specified by:
toZonedDateTimein interfaceConvertableTimeSource- Parameters:
zone- the time zone- Returns:
- a view of this source as a
ZonedDateTime
-
toLocalDate
Description copied from interface:ConvertableTimeSource- Specified by:
toLocalDatein interfaceConvertableTimeSource- Parameters:
zone- the time zone- Returns:
- a view of this source as a
LocalDate
-
toLocalTime
Description copied from interface:ConvertableTimeSource- Specified by:
toLocalTimein interfaceConvertableTimeSource- Parameters:
zone- the time zone- Returns:
- a view of this source as a
LocalTime
-
toDBDateTime
Description copied from interface:ConvertableTimeSourceConvert this source to aDBDateTimesource.- Specified by:
toDBDateTimein interfaceConvertableTimeSource- Returns:
- a view of this source as a
DBDateTime
-
toInstant
Description copied from interface:ConvertableTimeSourceConvert this source to anInstantsource.- Specified by:
toInstantin interfaceConvertableTimeSource- Returns:
- a view of this source as a
Instant
-
toEpochNano
Description copied from interface:ConvertableTimeSourceConvert this source to alongsource of nanoseconds of epoch.- Specified by:
toEpochNanoin interfaceConvertableTimeSource- Returns:
- a view of this source as a
ZonedDateTime
-