Class PlannerUtils

java.lang.Object
org.elasticsearch.xpack.esql.planner.PlannerUtils

public class PlannerUtils extends Object
  • Field Details

    • NON_BREAKING_BLOCK_FACTORY

      @Deprecated(forRemoval=true) public static final BlockFactory NON_BREAKING_BLOCK_FACTORY
      Deprecated, for removal: This API element is subject to removal in a future version.
      A non-breaking block factory used to create small pages during the planning TODO: Remove this
  • Constructor Details

    • PlannerUtils

      public PlannerUtils()
  • Method Details

    • breakPlanIntoSubPlansAndMainPlan

      public static org.elasticsearch.core.Tuple<List<PhysicalPlan>,PhysicalPlan> breakPlanIntoSubPlansAndMainPlan(PhysicalPlan plan)
      When the plan contains children like MergeExec resulted from the planning of commands such as FORK, we need to break the plan into sub plans and a main coordinator plan. The result pages from each sub plan will be funneled to the main coordinator plan. To achieve this, we wire each sub plan with a ExchangeSinkExec and add a ExchangeSourceExec to the main coordinator plan. There is an additional split of each sub plan into a data node plan and coordinator plan. This split is not done here, but as part of PlannerUtils#breakPlanBetweenCoordinatorAndDataNode.
    • breakPlanBetweenCoordinatorAndDataNode

      public static org.elasticsearch.core.Tuple<PhysicalPlan,PhysicalPlan> breakPlanBetweenCoordinatorAndDataNode(PhysicalPlan plan, Configuration config)
    • reductionPlan

      public static PhysicalPlan reductionPlan(PhysicalPlan plan)
    • planConcreteIndices

      public static Set<String> planConcreteIndices(PhysicalPlan plan)
      Returns a set of concrete indices after resolving the original indices specified in the FROM command.
    • planOriginalIndices

      public static String[] planOriginalIndices(PhysicalPlan plan)
      Returns the original indices specified in the FROM command of the query. We need the original query to resolve alias filters.
    • localPlan

      public static PhysicalPlan localPlan(EsqlFlags flags, List<SearchExecutionContext> searchContexts, Configuration configuration, FoldContext foldCtx, PhysicalPlan plan)
    • localPlan

      public static PhysicalPlan localPlan(EsqlFlags flags, Configuration configuration, FoldContext foldCtx, PhysicalPlan plan, SearchStats searchStats)
    • localPlan

      public static PhysicalPlan localPlan(PhysicalPlan plan, LocalLogicalPlanOptimizer logicalOptimizer, LocalPhysicalPlanOptimizer physicalOptimizer)
    • canMatchFilter

      public static QueryBuilder canMatchFilter(EsqlFlags flags, Configuration configuration, TransportVersion minTransportVersion, PhysicalPlan plan)
      Extracts a filter that can be used to skip unmatched shards on the coordinator.
    • toSortableElementType

      public static ElementType toSortableElementType(DataType dataType)
      Map QL's DataType to the compute engine's ElementType, for sortable types only. This specifically excludes spatial data types, which are not themselves sortable.
    • toElementType

      public static ElementType toElementType(DataType dataType)
      Map QL's DataType to the compute engine's ElementType.
    • toElementType

      public static ElementType toElementType(DataType dataType, MappedFieldType.FieldExtractPreference fieldExtractPreference)
      Map QL's DataType to the compute engine's ElementType. Under some situations, the same data type might be extracted into a different element type. For example, spatial types can be extracted into doc-values under specific conditions, otherwise they extract as BytesRef.
    • usesScoring

      public static boolean usesScoring(QueryPlan<?> plan)