Class FoldInferenceFunctions
java.lang.Object
org.elasticsearch.xpack.esql.optimizer.rules.logical.preoptimizer.FoldInferenceFunctions
- All Implemented Interfaces:
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, ...]
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFoldInferenceFunctions(InferenceFunctionEvaluator inferenceFunctionEvaluator) FoldInferenceFunctions(LogicalPreOptimizerContext preOptimizerContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(LogicalPlan plan, ActionListener<LogicalPlan> listener) Apply the rule to the logical plan.
-
Constructor Details
-
FoldInferenceFunctions
-
FoldInferenceFunctions
-
-
Method Details
-
apply
Description copied from interface:LogicalPlanPreOptimizerRuleApply the rule to the logical plan.- Specified by:
applyin interfaceLogicalPlanPreOptimizerRule- Parameters:
plan- the analyzed logical plan to pre-optimizelistener- the listener returning the pre-optimized plan when pre-optimization rule is applied
-