Class PromqlAttributesTranslationContext.InheritedAttributes

java.lang.Object
org.elasticsearch.xpack.esql.optimizer.rules.logical.promql.PromqlAttributesTranslationContext.InheritedAttributes
Enclosing class:
PromqlAttributesTranslationContext

public static final class PromqlAttributesTranslationContext.InheritedAttributes extends Object
The inherited attribute: the scope a subtree must preserve, threaded down the aggregate chain. An InheritedAttributes is produced by unconstrained() above the outermost aggregate and narrowed by each aggregate before being handed to its child. The leaf selector ends the descent with reflect().
  • Method Details

    • unconstrained

      Everything in scope (G=T), nothing excluded.
    • limitedTo

      BY(W): the child scope becomes exactly W, and the accumulated exclusions are cleared. A BY fixes its subtree's output to concrete keys, so any outer WITHOUT applies over those concrete labels (handled by the outer aggregate), not as a leaf _timeseries exclusion. Carrying the outer exclusions past a BY would wrongly inject a _timeseries into the inner concrete aggregate, making it group by identity \ excluded instead of W and leaking every other label.
    • excluding

      WITHOUT(E): E drops out of scope (G \ E) and joins the accumulated exclusions.
    • including

      A function-internal requirement (e.g. histogram_quantile materializing the le bucket label): keep the current scope and additionally require labels. Unlike limitedTo(java.util.List<org.elasticsearch.xpack.esql.core.expression.Attribute>) this widens the scope rather than replacing it; like BY it re-fixes the subtree to concrete keys and so clears the accumulated exclusions (the function regroups by concrete labels, so an outer WITHOUT applies over those keys at the outer aggregate, not as a leaf _timeseries exclusion). When the current scope is the full universe T the labels already cover it, so it collapses to exactly labels.
    • reflect

      End the descent at the leaf selector: it exposes exactly the labels demanded of it, with no exclusions of its own (the selector sits below every WITHOUT).
    • pathExclusions

      public List<Attribute> pathExclusions()
      Every dimension excluded along the path to here, for the innermost aggregate's TimeSeriesWithout.