Record Class ExternalOptimizerContext

java.lang.Object
java.lang.Record
org.elasticsearch.xpack.esql.optimizer.ExternalOptimizerContext

public record ExternalOptimizerContext(FormatReaderRegistry formatReaderRegistry) extends Record
Container for external-source planning state attached to LocalPhysicalOptimizerContext.

Today it carries only the FormatReaderRegistry, which a small set of optimizer rules consult to discover what an external source's underlying reader supports (filter pushdown, aggregate pushdown, deferred column extraction). Encapsulating it here keeps the parent context's signature stable as new external-source-only fields appear (e.g. capability sets, per-source statistics caches): future additions land on this record, never on LocalPhysicalOptimizerContext.

Instances are constructed once per local-plan invocation by PlannerUtils.localPlan(... FormatReaderRegistry ...); rules read through LocalPhysicalOptimizerContext.external(). Use NONE for callers (e.g. coordinator-side optimization, lookup-service planning, tests) that have no external sources in scope.

  • Field Details

    • NONE

      public static final ExternalOptimizerContext NONE
      Sentinel for callers without any external-source state. Rules that consult external capabilities must treat formatReaderRegistry == null as "no information" and bail out of the optimization, mirroring the previous behavior when the registry field was unset on the parent context.
  • Constructor Details

    • ExternalOptimizerContext

      public ExternalOptimizerContext(FormatReaderRegistry formatReaderRegistry)
      Creates an instance of a ExternalOptimizerContext record class.
      Parameters:
      formatReaderRegistry - the value for the formatReaderRegistry record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • formatReaderRegistry

      public FormatReaderRegistry formatReaderRegistry()
      Returns the value of the formatReaderRegistry record component.
      Returns:
      the value of the formatReaderRegistry record component