Interface PostAnalysisPlanVerificationAware

All Known Implementing Classes:
AggregateFunction, Avg, AvgOverTime, Bucket, Categorize, Count, CountDistinct, CountDistinctOverTime, CountOverTime, First, FirstOverTime, Fork, FromPartial, FullTextFunction, GroupingFunction, GroupingFunction.EvaluatableGroupingFunction, GroupingFunction.NonEvaluatableGroupingFunction, Knn, Kql, Last, LastOverTime, Match, MatchOperator, MatchPhrase, Max, MaxOverTime, Median, MedianAbsoluteDeviation, Min, MinOverTime, MultiMatch, NumericAggregate, Percentile, QueryString, Rate, Sample, SpatialAggregateFunction, SpatialCentroid, SpatialExtent, StdDev, Sum, SumOverTime, Term, TimeSeriesAggregateFunction, Top, ToPartial, Values, WeightedAvg

public interface PostAnalysisPlanVerificationAware
Interface implemented by expressions or plans that require validation after query plan analysis, when the indices and references have been resolved, but before the plan is transformed further by optimizations. The interface is similar to PostAnalysisVerificationAware, but focused on the tree structure, oftentimes covering semantic checks.
  • Method Summary

    Modifier and Type
    Method
    Description
    Allows the implementer to return a consumer that will perform self-validation in the context of the tree structure the implementer is part of.
  • Method Details

    • postAnalysisPlanVerification

      BiConsumer<LogicalPlan,Failures> postAnalysisPlanVerification()
      Allows the implementer to return a consumer that will perform self-validation in the context of the tree structure the implementer is part of. This usually involves checking the type and configuration of the children or that of the parent.

      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: a GroupingFunction instance, which models a function to group documents to aggregate over, can only be used in the context of the STATS command, modeled by the Aggregate class. This is how this verification is performed:

           
            @Override
            public BiConsumer<LogicalPlan, Failures> postAnalysisPlanVerification() {
                return (p, failures) -> {
                    if (p instanceof Aggregate == false) {
                        p.forEachExpression(
                            GroupingFunction.class,
                            gf -> failures.add(fail(gf, "cannot use grouping function [{}] outside of a STATS command", gf.sourceText()))
                        );
                    }
                };
            }
           
           
      Returns:
      a consumer that will receive a tree to check and an accumulator of failures found during inspection.