Class ViewResolver
java.lang.Object
org.elasticsearch.xpack.esql.view.ViewResolver
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordResult of view resolution containing both the rewritten plan and the view queries. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.elasticsearch.logging.Logger -
Constructor Summary
ConstructorsConstructorDescriptionPublic constructor for NOOP instance (in release mode, when component is not registered, but TransportEsqlQueryAction still needs it)ViewResolver(ClusterService clusterService, ProjectResolver projectResolver, Client client, CrossProjectModeDecider crossProjectModeDecider) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoEsqlResolveViewsRequest(EsqlResolveViewAction.Request request, ActionListener<EsqlResolveViewAction.Response> listener) voidreplaceViews(LogicalPlan plan, BiFunction<String, String, LogicalPlan> parser, ActionListener<ViewResolver.ViewResolutionResult> listener) Replaces views in the logical plan with their subqueries recursively.protected boolean
-
Field Details
-
log
protected org.elasticsearch.logging.Logger log -
MAX_VIEW_DEPTH_SETTING
-
-
Constructor Details
-
ViewResolver
public ViewResolver()Public constructor for NOOP instance (in release mode, when component is not registered, but TransportEsqlQueryAction still needs it) -
ViewResolver
public ViewResolver(ClusterService clusterService, ProjectResolver projectResolver, Client client, CrossProjectModeDecider crossProjectModeDecider)
-
-
Method Details
-
viewsFeatureEnabled
protected boolean viewsFeatureEnabled() -
replaceViews
public void replaceViews(LogicalPlan plan, BiFunction<String, String, LogicalPlan> parser, ActionListener<ViewResolver.ViewResolutionResult> listener) Replaces views in the logical plan with their subqueries recursively.This method performs a depth-first, top-down (pre-order) traversal of the plan tree. During traversal, it intercepts specific node types:
UnresolvedRelation: Resolves views and replaces them with their query plans, then recursively processes those plansFork: Recursively processes each child branchUnionAll: Skipped (assumes rewriting is already complete)
View resolution may introduce new nodes that need further processing, so explicit recursive calls are made on newly resolved view plans. The method tracks circular references and enforces maximum view depth limits.
- Parameters:
plan- the logical plan to processparser- function to parse view query strings into logical planslistener- callback that receives the rewritten plan and a map of view names to their queries
-
doEsqlResolveViewsRequest
protected void doEsqlResolveViewsRequest(EsqlResolveViewAction.Request request, ActionListener<EsqlResolveViewAction.Response> listener)
-