All Implemented Interfaces:
NamedWriteable, Writeable, PostAnalysisVerificationAware, TelemetryAware, Resolvable, ExecutesOn, ExecutesOn.Coordinator, PipelineBreaker, SortAgnostic
Direct Known Subclasses:
TimeSeriesAggregate

  • Field Details

  • Constructor Details

  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • getWriteableName

      public String getWriteableName()
      Specified by:
      getWriteableName in interface NamedWriteable
    • info

      protected NodeInfo<? extends Aggregate> info()
      Specified by:
      info in class Node<LogicalPlan>
    • replaceChild

      public Aggregate replaceChild(LogicalPlan newChild)
      Specified by:
      replaceChild in class UnaryPlan
    • with

      public Aggregate with(List<Expression> newGroupings, List<? extends NamedExpression> newAggregates)
    • with

      public Aggregate with(LogicalPlan child, List<Expression> newGroupings, List<? extends NamedExpression> newAggregates)
    • groupings

      public List<Expression> groupings()
      What this aggregation is grouped by. Generally, this corresponds to the BY clause, even though this command will not output those values unless they are also part of the aggregates(). This enables grouping without outputting the grouping keys, and makes it so that an Aggregates also acts as a projection.

      The actual grouping keys will be extracted from multivalues, so that if the grouping is on mv_field, and the document has mv_field: [1, 2, 2], then the document will be part of the groups for both mv_field=1 and mv_field=2 (and counted only once in each group).

    • aggregates

      public List<? extends NamedExpression> aggregates()
      The actual aggregates to compute. This includes the grouping keys if they are to be output.

      Multivalued grouping keys will be extracted into single values, so that if the grouping is on mv_field, and the document has mv_field: [1, 2, 2], then the output will have two corresponding rows, one with mv_field=1 and one with mv_field=2.

    • telemetryLabel

      public String telemetryLabel()
      Specified by:
      telemetryLabel in interface TelemetryAware
      Returns:
      the label reported in the telemetry data. Only needs to be overwritten if the label doesn't match the class name.
    • expressionsResolved

      public boolean expressionsResolved()
      Specified by:
      expressionsResolved in class LogicalPlan
    • output

      public List<Attribute> output()
      Description copied from class: QueryPlan
      The ordered list of attributes (i.e. columns) this plan produces when executed. Must be called only on resolved plans, otherwise may throw an exception or return wrong results.
      Overrides:
      output in class UnaryPlan
    • output

      public static List<Attribute> output(List<? extends NamedExpression> aggregates)
    • computeReferences

      protected AttributeSet computeReferences()
      Description copied from class: QueryPlan
      This very likely needs to be overridden for QueryPlan.references() to be correct when inheriting. This can be called on unresolved plans and therefore must not rely on calls to QueryPlan.output().
      Overrides:
      computeReferences in class QueryPlan<LogicalPlan>
    • computeReferences

      public static AttributeSet computeReferences(List<? extends NamedExpression> aggregates, List<? extends Expression> groupings)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class UnaryPlan
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class UnaryPlan
    • postAnalysisVerification

      public void postAnalysisVerification(Failures failures)
      Description copied from interface: PostAnalysisVerificationAware
      Allows the implementer to validate itself. This usually involves checking its internal setup, which often means checking the parameters it received on construction: their data or syntactic type, class, their count, expressions' structure etc. The discovered failures are added to the given Failures object.

      It is often more useful to perform the checks as extended as it makes sense, over stopping at the first failure. This will allow the author to progress faster to a correct query.

      Example: the Filter class, which models the WHERE command, checks that the expression it filters on - condition - is of a Boolean or NULL type:

           
           @Override
           void postAnalysisVerification(Failures failures) {
                if (condition.dataType() != NULL && condition.dataType() != BOOLEAN) {
                    failures.add(fail(condition, "Condition expression needs to be boolean, found [{}]", condition.dataType()));
                }
           }
           
           
      Specified by:
      postAnalysisVerification in interface PostAnalysisVerificationAware
      Parameters:
      failures - the object to add failures to.
    • checkTimeSeriesAggregates

      protected void checkTimeSeriesAggregates(Failures failures)