Module org.elasticsearch.compute
Class TemporalityAccessor
java.lang.Object
org.elasticsearch.compute.aggregation.TemporalityAccessor
Helper class for efficiently resolving metric temporality (CUMULATIVE or DELTA) from a
BytesRefBlock.
Optimizes for common access patterns by detecting constant blocks, ordinal-based blocks, or falling back
to dynamic per-position lookups.-
Constructor Summary
ConstructorsConstructorDescriptionTemporalityAccessor(org.elasticsearch.compute.aggregation.TemporalityAccessor.Mode mode, Temporality constantOrDefaultTemporality, BytesRefBlock temporalityBlock, org.apache.lucene.util.BytesRef scratch, Function<org.apache.lucene.util.BytesRef, Temporality> invalidTemporalityHandler) -
Method Summary
Modifier and TypeMethodDescriptionblock()static TemporalityAccessorconstant(Temporality constantTemporality) Creates an accessor that always returns the given constant temporality.static TemporalityAccessorcreate(BytesRefBlock temporalityBlock, Temporality defaultTemporality) Creates an accessor for the given temporality block that throwsInvalidTemporalityExceptionwhen an unrecognized temporality value is encountered.static TemporalityAccessorcreate(BytesRefBlock temporalityBlock, Temporality defaultTemporality, Function<org.apache.lucene.util.BytesRef, Temporality> invalidTemporalityHandler) Creates an accessor for the given temporality block, automatically selecting the most efficient access mode.get(int position) Returns the temporality for the given position.
-
Constructor Details
-
TemporalityAccessor
public TemporalityAccessor(org.elasticsearch.compute.aggregation.TemporalityAccessor.Mode mode, Temporality constantOrDefaultTemporality, @Nullable BytesRefBlock temporalityBlock, @Nullable org.apache.lucene.util.BytesRef scratch, @Nullable Function<org.apache.lucene.util.BytesRef, Temporality> invalidTemporalityHandler)
-
-
Method Details
-
constant
Creates an accessor that always returns the given constant temporality. -
create
public static TemporalityAccessor create(BytesRefBlock temporalityBlock, Temporality defaultTemporality) Creates an accessor for the given temporality block that throwsInvalidTemporalityExceptionwhen an unrecognized temporality value is encountered.- Parameters:
temporalityBlock- the block containing temporality values as BytesRef strings ("cumulative" or "delta")defaultTemporality- the temporality to use for null values
-
create
public static TemporalityAccessor create(BytesRefBlock temporalityBlock, Temporality defaultTemporality, Function<org.apache.lucene.util.BytesRef, Temporality> invalidTemporalityHandler) Creates an accessor for the given temporality block, automatically selecting the most efficient access mode.- Parameters:
temporalityBlock- the block containing temporality values as BytesRef strings ("cumulative" or "delta")defaultTemporality- the temporality to use for null valuesinvalidTemporalityHandler- called when an unrecognized temporality value is encountered
-
block
-
get
Returns the temporality for the given position.
-