All Implemented Interfaces:
NamedWriteable, Writeable, PostAnalysisPlanVerificationAware, Resolvable
Direct Known Subclasses:
GroupingFunction.EvaluatableGroupingFunction, GroupingFunction.NonEvaluatableGroupingFunction

  • Constructor Details

  • Method Details

    • postAnalysisPlanVerification

      public BiConsumer<LogicalPlan,Failures> postAnalysisPlanVerification()
      Description copied from interface: PostAnalysisPlanVerificationAware
      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()))
                        );
                    }
                };
            }
           
           
      Specified by:
      postAnalysisPlanVerification in interface PostAnalysisPlanVerificationAware
      Returns:
      a consumer that will receive a tree to check and an accumulator of failures found during inspection.