java.lang.Object
org.elasticsearch.xpack.esql.optimizer.rules.RuleUtils

public final class RuleUtils extends Object
  • Method Details

    • aliasedNulls

      public static org.elasticsearch.core.Tuple<List<Alias>,List<NamedExpression>> aliasedNulls(List<Attribute> outputAttributes, Predicate<Attribute> shouldBeReplaced)
      Returns a tuple of two lists: 1. A list of aliases to null literals for those data types in the that . 2. A list of named expressions where attributes that match the predicate are replaced with their corresponding null alias.
      Parameters:
      outputAttributes - The original output attributes.
      shouldBeReplaced - A predicate to determine which attributes should be replaced with null aliases.
    • foldableReferences

      public static AttributeMap<Expression> foldableReferences(LogicalPlan plan, LogicalOptimizerContext ctx)
      Collects references to foldables from the given logical plan, returning an AttributeMap that maps foldable aliases to their corresponding literal values.
      Parameters:
      plan - The logical plan to analyze.
      ctx - The optimizer context providing fold context.
      Returns:
      An AttributeMap containing foldable references and their literal values.