Class InferenceFunctionEvaluator

java.lang.Object
org.elasticsearch.xpack.esql.inference.InferenceFunctionEvaluator

public class InferenceFunctionEvaluator extends Object
Evaluator for inference functions that performs constant folding by executing inference operations at optimization time and replacing them with their computed results.
  • Method Details

    • factory

      public static InferenceFunctionEvaluator.Factory factory()
    • fold

      public void fold(InferenceFunction<?> f, ActionListener<Expression> listener)
      Folds an inference function by executing it and replacing it with its computed result.

      This method performs the following steps:

      1. Validates that the function is foldable (has constant parameters)
      2. Sets up a minimal execution context with appropriate circuit breakers
      3. Creates and configures the appropriate inference operator
      4. Executes the inference operation asynchronously
      5. Converts the result to a Literal expression
      Parameters:
      f - the inference function to fold - must be foldable (have constant parameters)
      listener - the listener to notify when folding completes successfully or fails