All Implemented Interfaces:
NamedWriteable, Writeable, Resolvable, EvaluatorMapper, ConvertFunction

public class ToCounter extends AbstractConvertFunction
Converts a numeric value to its counter-typed equivalent. The output type depends on the input: long becomes counter_long, integer becomes counter_integer, and double becomes counter_double. Counter inputs are returned unchanged (idempotent). No values are modified; this is a pure type-annotation change.
  • Field Details

  • Constructor Details

  • Method Details

    • getWriteableName

      public String getWriteableName()
    • factories

      Description copied from class: AbstractConvertFunction
      A map from input type to ExpressionEvaluator ctor. 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:
      factories in class AbstractConvertFunction
    • dataType

      public DataType dataType()
      Returns the counter variant of the input type: long→counter_long, etc. Counter inputs pass through unchanged. Returns DataType.NULL when the field type is not yet resolved or has no counter variant.
      Overrides:
      dataType in class UnaryScalarFunction
    • replaceChildren

      public Expression replaceChildren(List<Expression> newChildren)
      Specified by:
      replaceChildren in class Node<Expression>
    • info

      protected NodeInfo<? extends Expression> info()
      Description copied from class: Node
      Normally, you want to use one of the static create methods 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 like QueryPlan#transformExpressionsOnly(Function) will not have an effect.

      Specified by:
      info in class Node<Expression>