Class ToGauge
java.lang.Object
org.elasticsearch.xpack.esql.core.tree.Node<Expression>
org.elasticsearch.xpack.esql.core.expression.Expression
org.elasticsearch.xpack.esql.core.expression.function.Function
org.elasticsearch.xpack.esql.core.expression.function.scalar.ScalarFunction
org.elasticsearch.xpack.esql.expression.function.scalar.EsqlScalarFunction
org.elasticsearch.xpack.esql.expression.function.scalar.UnaryScalarFunction
org.elasticsearch.xpack.esql.expression.function.scalar.convert.AbstractConvertFunction
org.elasticsearch.xpack.esql.expression.function.scalar.convert.ToGauge
- All Implemented Interfaces:
NamedWriteable,Writeable,Resolvable,EvaluatorMapper,ConvertFunction
Converts a counter-typed value to its plain numeric (gauge) equivalent.
The output type depends on the input:
counter_long becomes long,
counter_integer becomes integer, and counter_double becomes double.
Plain numeric inputs are returned unchanged (idempotent).
aggregate_metric_double inputs are also returned unchanged (idempotent).
No values are modified; this is a pure type-annotation change.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.xpack.esql.expression.function.scalar.convert.AbstractConvertFunction
AbstractConvertFunction.AbstractEvaluator, AbstractConvertFunction.BuildFactoryNested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
Expression.TypeResolutionNested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.tree.Node
Node.NodeStringFormatNested classes/interfaces inherited from interface org.elasticsearch.xpack.esql.evaluator.mapper.EvaluatorMapper
EvaluatorMapper.ToEvaluatorNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FunctionDefinitionstatic final NamedWriteableRegistry.EntryFields inherited from class org.elasticsearch.xpack.esql.expression.function.scalar.UnaryScalarFunction
fieldFields inherited from class org.elasticsearch.xpack.esql.core.expression.function.scalar.ScalarFunction
MAX_BYTES_REF_RESULT_SIZEFields inherited from class org.elasticsearch.xpack.esql.core.tree.Node
TO_STRING_MAX_LINES, TO_STRING_MAX_WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondataType()Returns the plain numeric variant of the input type:counter_long→long, etc.protected Map<DataType, AbstractConvertFunction.BuildFactory> A map from input type toExpressionEvaluatorctor.protected NodeInfo<? extends Expression> info()Normally, you want to use one of the staticcreatemethods to implement this.static booleanReturnstruewhenTO_GAUGEwould be a no-op on every branch of a union field — every mapped type is already a non-counter type (includingDataType.AGGREGATE_METRIC_DOUBLE).replaceChildren(List<Expression> newChildren) Methods inherited from class org.elasticsearch.xpack.esql.expression.function.scalar.convert.AbstractConvertFunction
evaluator, resolveType, supportedTypes, toEvaluatorMethods inherited from class org.elasticsearch.xpack.esql.expression.function.scalar.UnaryScalarFunction
field, foldable, writeToMethods inherited from class org.elasticsearch.xpack.esql.expression.function.scalar.EsqlScalarFunction
foldMethods inherited from class org.elasticsearch.xpack.esql.core.expression.function.Function
arguments, equals, functionName, hashCode, nodeString, nullableMethods inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
canonical, canonicalize, childrenResolved, propertiesToString, references, resolved, semanticEquals, semanticHash, toString, toString, typeResolvedMethods inherited from class org.elasticsearch.xpack.esql.core.tree.Node
allMatch, anyMatch, children, collect, collect, collect, collectFirstChildren, collectLeaves, doCollectFirst, forEachDown, forEachDown, forEachDownMayReturnEarly, forEachProperty, forEachPropertyDown, forEachPropertyOnly, forEachPropertyUp, forEachUp, forEachUp, nodeName, nodeProperties, nodeString, replaceChildrenSameSize, source, sourceLocation, sourceText, toString, transformChildren, transformChildren, transformDown, transformDown, transformDown, transformDown, transformDownSkipBranch, transformNodeProps, transformPropertiesDown, transformPropertiesOnly, transformPropertiesUp, transformUp, transformUp, transformUpMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xpack.esql.expression.function.scalar.convert.ConvertFunction
fieldMethods inherited from interface org.elasticsearch.xpack.esql.evaluator.mapper.EvaluatorMapper
fold
-
Field Details
-
ENTRY
-
DEFINITION
-
-
Constructor Details
-
ToGauge
-
-
Method Details
-
getWriteableName
-
factories
Description copied from class:AbstractConvertFunctionA map from input type toExpressionEvaluatorctor. Usually implemented like:private static final Map<DataType, BuildFactory> EVALUATORS = Map.ofEntries( Map.entry(BOOLEAN, (field, source) -> field), Map.entry(KEYWORD, ToBooleanFromStringEvaluator.Factory::new), ... ); @Override protected Map<DataType, BuildFactory> factories() { return EVALUATORS; }- Specified by:
factoriesin classAbstractConvertFunction
-
dataType
Returns the plain numeric variant of the input type:counter_long→long, etc. Plain numeric inputs pass through unchanged. Returns the input type unchanged when it is not yet resolved or has no counter variant to strip (DataType.noCounter()default branch).- Overrides:
dataTypein classUnaryScalarFunction
-
isNoOpOnAllUnionTypes
ReturnstruewhenTO_GAUGEwould be a no-op on every branch of a union field — every mapped type is already a non-counter type (includingDataType.AGGREGATE_METRIC_DOUBLE). -
replaceChildren
- Specified by:
replaceChildrenin classNode<Expression>
-
info
Description copied from class:NodeNormally, you want to use one of the staticcreatemethods to implement this.For
QueryPlans, it is very important that the properties contain all of the expressions and references relevant to this node, and that all the properties are used in the provided constructor; otherwise query plan transformations likeQueryPlan#transformExpressionsOnly(Function)will not have an effect.- Specified by:
infoin classNode<Expression>
-