Package com.illumon.iris.db.v2.sources
Class NanosBasedTimeSparseArraySource<TIME_TYPE>
java.lang.Object
com.illumon.iris.db.v2.sources.AbstractColumnSource<T>
com.illumon.iris.db.v2.sources.SparseArrayColumnSource<TIME_TYPE>
com.illumon.iris.db.v2.sources.NanosBasedTimeSparseArraySource<TIME_TYPE>
- All Implemented Interfaces:
ChunkSource<Attributes.Values>
,ChunkSource.WithPrev<Attributes.Values>
,DefaultChunkSource<Attributes.Values>
,DefaultChunkSource.WithPrev<Attributes.Values>
,FillContextMaker
,GetContextMaker
,ColumnSource<TIME_TYPE>
,ConvertableTimeSource
,ElementSource<TIME_TYPE>
,FillUnordered
,Releasable
,WritableChunkSink<Attributes.Values>
,WritableSource<TIME_TYPE>
,TupleExporter<TIME_TYPE>
,TupleSource<TIME_TYPE>
,Serializable
- Direct Known Subclasses:
DateTimeSparseArraySource
,InstantSparseArraySource
,ZonedDateTimeSparseArraySource
public abstract class NanosBasedTimeSparseArraySource<TIME_TYPE> extends SparseArrayColumnSource<TIME_TYPE> implements DefaultChunkSource<Attributes.Values>, ConvertableTimeSource
Array-backed ColumnSource for TIME_TYPEs. Allows reinterpret as long.
- See Also:
- Serialized Form
-
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.IsSerializable
Nested 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.Zoned
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
Fields Modifier and Type Field Description protected LongSparseArraySource
nanoSource
Fields inherited from class com.illumon.iris.db.v2.sources.SparseArrayColumnSource
ZERO_LENGTH_SPARSE_ARRAY_COLUMN_SOURCE_ARRAY
Fields inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource
DEFAULT_FILL_INSTANCE, ZERO_LENGTH_CHUNK_SOURCE_ARRAY
Fields inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource.WithPrev
ZERO_LENGTH_CHUNK_SOURCE_WITH_PREV_ARRAY
Fields inherited from interface com.illumon.iris.db.v2.sources.ColumnSource
ZERO_LENGTH_COLUMN_SOURCE_ARRAY
Fields inherited from interface com.illumon.iris.db.v2.sources.WritableChunkSink
DEFAULT_FILL_FROM_INSTANCE
Fields inherited from interface com.illumon.iris.db.v2.sources.WritableSource
ZERO_LENGTH_WRITABLE_SOURCE_ARRAY
-
Constructor Summary
Constructors Constructor Description NanosBasedTimeSparseArraySource(Class<TIME_TYPE> type)
NanosBasedTimeSparseArraySource(Class<TIME_TYPE> type, LongSparseArraySource nanoSource)
-
Method Summary
Modifier and Type Method Description <ALTERNATE_DATA_TYPE>
booleanallowsReinterpret(Class<ALTERNATE_DATA_TYPE> alternateDataType)
Test if a reinterpret call will succeed.void
copy(ColumnSource<TIME_TYPE> sourceColumn, long sourceKey, long destKey)
protected <ALTERNATE_DATA_TYPE>
ColumnSource<ALTERNATE_DATA_TYPE>doReinterpret(Class<ALTERNATE_DATA_TYPE> alternateDataType)
Supply allowed reinterpret results.void
ensureCapacity(long capacity)
void
fillChunk(ChunkSource.FillContext context, WritableChunk<? super Attributes.Values> dest, OrderedKeys orderedKeys)
Populates the given destination chunk with data corresponding to the keys from the givenOrderedKeys
.void
fillFromChunkByKeys(OrderedKeys orderedKeys, Chunk<? extends Attributes.Values> src)
void
fillFromChunkByRanges(OrderedKeys orderedKeys, Chunk<? extends Attributes.Values> src)
void
fillFromChunkUnordered(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.void
fillPrevChunk(ChunkSource.FillContext context, WritableChunk<? super Attributes.Values> dest, OrderedKeys orderedKeys)
Populates the given destination chunk with data corresponding to the keys from the givenOrderedKeys
.TIME_TYPE
get(long index)
Get the value from the source.Chunk<Attributes.Values>
getChunk(ChunkSource.GetContext context, OrderedKeys orderedKeys)
Returns a chunk of data corresponding to the keys from the givenOrderedKeys
.long
getLong(long index)
Get the value at the index as a long.TIME_TYPE
getPrev(long index)
Get the previous value at the index.Chunk<Attributes.Values>
getPrevChunk(ChunkSource.GetContext context, OrderedKeys orderedKeys)
Returns a chunk of previous data corresponding to the keys from the givenOrderedKeys
.long
getPrevLong(long index)
Get the previous value at the index as a long.protected abstract TIME_TYPE
makeValue(long nanos)
void
set(long key, long value)
void
set(long key, TIME_TYPE value)
void
setNull(long key)
void
shift(ReadOnlyIndex keysToShift, long shiftDelta)
void
startTrackingPrevValues()
ColumnSource implementations that track previous values have the option to not actually start tracking previous values until this method is called.boolean
supportsTimeConversion()
Check if this class supports time conversion.ColumnSource<DBDateTime>
toDBDateTime()
Convert this source to aDBDateTime
source.LongSparseArraySource
toEpochNano()
Convert this source to along
source of nanoseconds of epoch.ColumnSource<Instant>
toInstant()
Convert this source to anInstant
source.ColumnSource<LocalDate>
toLocalDate(ZoneId zone)
ColumnSource<LocalTime>
toLocalTime(ZoneId zone)
protected abstract long
toNanos(TIME_TYPE value)
ColumnSource<ZonedDateTime>
toZonedDateTime(ZoneId zone)
Convert this source to aZonedDateTime
source at the specifiedzone
.Methods inherited from class com.illumon.iris.db.v2.sources.SparseArrayColumnSource
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, setNull
Methods inherited from class com.illumon.iris.db.v2.sources.AbstractColumnSource
defaultFillChunk, getComponentType, getGroupingBuilder, getGroupingProvider, getNativeType, getType, hasGrouping, isSerializable, match, reinterpret, setGroupingProvider
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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, match, reinterpret, releaseCachedResources, setGroupingProvider
Methods inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource
getChunk, getChunkByFilling, makeFillContext, makeGetContext
Methods inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource.WithPrev
getPrevChunk, getPrevChunkByFilling
Methods inherited from interface com.illumon.iris.db.v2.sources.ElementSource
getBoolean, getByte, getChar, getDouble, getFloat, getInt, getPrevBoolean, getPrevByte, getPrevChar, getPrevDouble, getPrevFloat, getPrevInt, getPrevShort, getShort
Methods inherited from interface com.illumon.iris.db.v2.sources.chunk.FillContextMaker
makeFillContext
Methods inherited from interface com.illumon.iris.db.v2.sources.chunk.GetContextMaker
makeGetContext
Methods inherited from interface com.illumon.iris.db.v2.tuples.TupleExporter
exportElementReinterpreted
Methods inherited from interface com.illumon.iris.db.v2.tuples.TupleSource
createTupleFromReinterpretedValues
-
Field Details
-
Constructor Details
-
NanosBasedTimeSparseArraySource
-
NanosBasedTimeSparseArraySource
public NanosBasedTimeSparseArraySource(@NotNull Class<TIME_TYPE> type, @NotNull LongSparseArraySource nanoSource)
-
-
Method Details
-
makeValue
-
toNanos
-
set
- Specified by:
set
in interfaceWritableSource<TIME_TYPE>
-
set
public void set(long key, long value)- Specified by:
set
in interfaceWritableSource<TIME_TYPE>
- Overrides:
set
in classSparseArrayColumnSource<TIME_TYPE>
-
setNull
public void setNull(long key)- Specified by:
setNull
in interfaceWritableSource<TIME_TYPE>
-
get
Description copied from interface:ElementSource
Get the value from the source. This may return boxed values for basic types.- Specified by:
get
in interfaceElementSource<TIME_TYPE>
- 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:ElementSource
Get the previous value at the index. Previous values are used during anLTM
update
cycle to process changes in data. Duringnormal
operation previous values will be identical tocurrent
values.- Specified by:
getPrev
in interfaceElementSource<TIME_TYPE>
- Parameters:
index
- the location in index space to get the value from.- Returns:
- the previous value at the index, or null.
-
getLong
public long getLong(long index)Description copied from interface:ElementSource
Get the value at the index as a long.- Specified by:
getLong
in interfaceElementSource<TIME_TYPE>
- 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 long getPrevLong(long index)Description copied from interface:ElementSource
Get the previous value at the index as a long. SeeElementSource.getPrev(long)
for more details.- Specified by:
getPrevLong
in interfaceElementSource<TIME_TYPE>
- 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
-
copy
- Specified by:
copy
in interfaceWritableSource<TIME_TYPE>
-
shift
- Overrides:
shift
in classSparseArrayColumnSource<TIME_TYPE>
-
ensureCapacity
public void ensureCapacity(long capacity)- Specified by:
ensureCapacity
in interfaceWritableSource<TIME_TYPE>
-
startTrackingPrevValues
public void startTrackingPrevValues()Description copied from interface:ColumnSource
ColumnSource 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:
startTrackingPrevValues
in interfaceColumnSource<TIME_TYPE>
-
fillChunk
public void fillChunk(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Attributes.Values> dest, @NotNull OrderedKeys orderedKeys)Description copied from interface:ChunkSource
Populates the given destination chunk with data corresponding to the keys from the givenOrderedKeys
.- Specified by:
fillChunk
in interfaceChunkSource<TIME_TYPE>
- Overrides:
fillChunk
in classSparseArrayColumnSource<TIME_TYPE>
- 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
- AnOrderedKeys
representing the keys to be fetched
-
fillPrevChunk
public void fillPrevChunk(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Attributes.Values> dest, @NotNull OrderedKeys orderedKeys)Description copied from interface:ChunkSource.WithPrev
Populates the given destination chunk with data corresponding to the keys from the givenOrderedKeys
.- Specified by:
fillPrevChunk
in interfaceChunkSource.WithPrev<TIME_TYPE>
- Overrides:
fillPrevChunk
in classAbstractColumnSource<TIME_TYPE>
- 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
- AnOrderedKeys
representing the keys to be fetched
-
getChunk
public Chunk<Attributes.Values> getChunk(@NotNull ChunkSource.GetContext context, @NotNull OrderedKeys orderedKeys)Description copied from interface:ChunkSource
Returns a chunk of data corresponding to the keys from the givenOrderedKeys
.- Specified by:
getChunk
in interfaceChunkSource<TIME_TYPE>
- Specified by:
getChunk
in interfaceDefaultChunkSource<TIME_TYPE>
- 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
- AnOrderedKeys
representing the keys to be fetched- Returns:
- A chunk of data corresponding to the keys from the given
OrderedKeys
-
getPrevChunk
public Chunk<Attributes.Values> getPrevChunk(@NotNull ChunkSource.GetContext context, @NotNull OrderedKeys orderedKeys)Description copied from interface:ChunkSource.WithPrev
Returns a chunk of previous data corresponding to the keys from the givenOrderedKeys
.- Specified by:
getPrevChunk
in interfaceChunkSource.WithPrev<TIME_TYPE>
- Specified by:
getPrevChunk
in interfaceDefaultChunkSource.WithPrev<TIME_TYPE>
- 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
- AnOrderedKeys
representing the keys to be fetched- Returns:
- A chunk of data corresponding to the keys from the given
OrderedKeys
.
-
fillFromChunkByRanges
public void fillFromChunkByRanges(@NotNull OrderedKeys orderedKeys, Chunk<? extends Attributes.Values> src) -
fillFromChunkByKeys
public void fillFromChunkByKeys(@NotNull OrderedKeys orderedKeys, Chunk<? extends Attributes.Values> src) -
fillFromChunkUnordered
public void fillFromChunkUnordered(@NotNull WritableChunkSink.FillFromContext context, @NotNull Chunk<? extends Attributes.Values> src, @NotNull LongChunk<Attributes.KeyIndices> keys)Description copied from interface:WritableChunkSink
Fills the ChunkSink with data from the source, with data corresponding to the keys from the given key chunk.- Specified by:
fillFromChunkUnordered
in interfaceWritableChunkSink<TIME_TYPE>
- Specified by:
fillFromChunkUnordered
in interfaceWritableSource<TIME_TYPE>
- Parameters:
context
- A context containing all mutable/state related data used in writing the Chunk.src
- The source of the dataorderedKeys
keys
- ALongChunk
representing the keys to be written
-
allowsReinterpret
public <ALTERNATE_DATA_TYPE> boolean allowsReinterpret(@NotNull Class<ALTERNATE_DATA_TYPE> alternateDataType)Description copied from interface:ColumnSource
Test if a reinterpret call will succeed.- Specified by:
allowsReinterpret
in interfaceColumnSource<TIME_TYPE>
- Overrides:
allowsReinterpret
in classAbstractColumnSource<TIME_TYPE>
- 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:AbstractColumnSource
Supply allowed reinterpret results. The default implementation handles the most common case to avoid code duplication.- Overrides:
doReinterpret
in classAbstractColumnSource<TIME_TYPE>
- 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:ConvertableTimeSource
Check if this class supports time conversion. If false, all other methods will fail.- Specified by:
supportsTimeConversion
in interfaceConvertableTimeSource
- Returns:
- true if time conversion is supported.
-
toZonedDateTime
Description copied from interface:ConvertableTimeSource
Convert this source to aZonedDateTime
source at the specifiedzone
.- Specified by:
toZonedDateTime
in interfaceConvertableTimeSource
- Parameters:
zone
- the time zone- Returns:
- a view of this source as a
ZonedDateTime
-
toLocalDate
Description copied from interface:ConvertableTimeSource
- Specified by:
toLocalDate
in interfaceConvertableTimeSource
- Parameters:
zone
- the time zone- Returns:
- a view of this source as a
LocalDate
-
toLocalTime
Description copied from interface:ConvertableTimeSource
- Specified by:
toLocalTime
in interfaceConvertableTimeSource
- Parameters:
zone
- the time zone- Returns:
- a view of this source as a
LocalTime
-
toDBDateTime
Description copied from interface:ConvertableTimeSource
Convert this source to aDBDateTime
source.- Specified by:
toDBDateTime
in interfaceConvertableTimeSource
- Returns:
- a view of this source as a
DBDateTime
-
toInstant
Description copied from interface:ConvertableTimeSource
Convert this source to anInstant
source.- Specified by:
toInstant
in interfaceConvertableTimeSource
- Returns:
- a view of this source as a
Instant
-
toEpochNano
Description copied from interface:ConvertableTimeSource
Convert this source to along
source of nanoseconds of epoch.- Specified by:
toEpochNano
in interfaceConvertableTimeSource
- Returns:
- a view of this source as a
ZonedDateTime
-