java.lang.Object
org.elasticsearch.xpack.esql.optimizer.rules.logical.preoptimizer.FoldInferenceFunctions
All Implemented Interfaces:
LogicalPlanPreOptimizerRule

public class FoldInferenceFunctions extends Object implements LogicalPlanPreOptimizerRule
Pre-optimizer rule that performs constant folding for inference functions in logical plans.

This rule identifies inference functions with constant parameters and evaluates them at optimization time, replacing them with their computed results.

The folding process is recursive and handles nested inference functions by processing them in multiple passes until no more foldable functions remain.

Example transformation: TEXT_EMBEDDING("hello world", "model1")[0.1, 0.2, 0.3, ...]