Class ViewShadowRelation
java.lang.Object
org.elasticsearch.xpack.esql.core.tree.Node<LogicalPlan>
org.elasticsearch.xpack.esql.plan.QueryPlan<LogicalPlan>
org.elasticsearch.xpack.esql.plan.logical.LogicalPlan
org.elasticsearch.xpack.esql.plan.logical.LeafPlan
org.elasticsearch.xpack.esql.plan.logical.ViewShadowRelation
- All Implemented Interfaces:
NamedWriteable,Writeable,Resolvable,Unresolvable
Marker leaf node that represents a view-name being looked up on linked projects (CPS) as a
potential remote index with the same name as a local view. It is emitted by
ViewResolver (only when CPS is enabled) as a sibling
of each resolved view's recursive substitution, inside the per-resolution-level
ViewUnionAll.
Lifecycle, with the parts each PR is responsible for:
- Emitted during view resolution alongside the strict (recursive) resolution. The shadow
and its strict sibling form the strict/lenient pair for that level.
(landed in the
ViewResolverrefactor) ViewCompaction.preIndexResolutionreshapes user-writtenSubquery/UnionAllstructures intoViewUnionAllbut leaves shadows in place so PreAnalyzer can still pair each shadow with its sibling at index-resolution time. (landed)PreAnalyzercollectsViewShadowRelationpatterns into a separate set, andEsqlSessionissues a lenient field-caps request per batch (ALLOW_UNAVAILABLE_TARGETS+ project routing scoped to linked projects only —IndexResolver.FLAT_WORLD_OPTIONS). Results land inAnalyzerContext.optionalLinkedResolution, keyed by the shadow's fulllinkedIndexPattern()(view name + applicable exclusions). (deferred to the lenient field-caps PR)- The
ResolveViewShadowanalyzer rule (sibling ofResolveTable, in the Initialize batch) consultsAnalyzerContext.optionalLinkedResolutionfor this shadow'slinkedIndexPattern(). If a remote index is found the shadow is replaced with a correspondingEsRelation; otherwise the shadow is left unresolved. (this PR — backed by a mockedoptionalLinkedResolutionmap until the lenient field-caps PR provides real data) ViewCompactionPostIndexResolutionruns afterResolveViewShadow: any still-unresolved shadow is stripped, then nestedViewUnionAlls are flattened and remainingNamedSubquerywrappers unwrapped. Per Strategy A in esql-planning#543, siblingEsRelations stay separate (aUnionAll/ViewUnionAllofEsRelations) rather than being merged via a third combined field-caps call. (landed)
resolveViews(true)
unchanged, so a remote project that has a view with the same name still fails the query
with RemoteViewNotSupportedException. This node only enables lookup of remote
indices with the same name as a local view.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.xpack.esql.plan.logical.LogicalPlan
LogicalPlan.StageNested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.tree.Node
Node.NodeStringFormatNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from class org.elasticsearch.xpack.esql.core.tree.Node
TO_STRING_MAX_LINES, TO_STRING_MAX_WIDTHFields inherited from interface org.elasticsearch.xpack.esql.core.capabilities.Unresolvable
UNRESOLVED_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionViewShadowRelation(Source source, String viewName, LinkedIndexPattern.Kind kind, String pattern) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleaninthashCode()protected NodeInfo<ViewShadowRelation> info()Normally, you want to use one of the staticcreatemethods to implement this.The values of all the properties that are important to thisNode.output()The ordered list of attributes (i.e.booleanresolved()toString()NOTE: Any non-null return value from this method indicates that the item in question could not be resolved.viewName()voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.xpack.esql.plan.logical.LeafPlan
computeReferences, replaceChildrenMethods inherited from class org.elasticsearch.xpack.esql.plan.logical.LogicalPlan
analyzed, childrenResolved, optimized, preAnalyzed, preOptimized, setAnalyzed, setOptimized, setPreAnalyzed, setPreOptimizedMethods inherited from class org.elasticsearch.xpack.esql.plan.QueryPlan
computeExpressions, expressions, forEachExpression, forEachExpression, forEachExpressionDown, forEachExpressionUp, inputSet, outputSet, references, transformExpressionsDown, transformExpressionsDown, transformExpressionsOnly, transformExpressionsOnly, transformExpressionsOnlyUp, transformExpressionsUp, transformExpressionsUpMethods inherited from class org.elasticsearch.xpack.esql.core.tree.Node
allMatch, anyMatch, children, collect, collect, collect, collectFirstChildren, collectLeaves, doCollectFirst, forEachDown, forEachDown, forEachDownMayReturnEarly, forEachProperty, forEachPropertyDown, forEachPropertyOnly, forEachPropertyUp, forEachUp, forEachUp, nodeName, nodeString, nodeString, propertiesToString, replaceChildrenSameSize, source, sourceLocation, sourceText, toString, toString, transformChildren, transformChildren, transformDown, transformDown, transformDown, transformDown, transformDownSkipBranch, transformNodeProps, transformPropertiesDown, transformPropertiesOnly, transformPropertiesUp, transformUp, transformUp, transformUp
-
Constructor Details
-
ViewShadowRelation
public ViewShadowRelation(Source source, String viewName, LinkedIndexPattern.Kind kind, String pattern)
-
-
Method Details
-
viewName
-
linkedIndexPattern
-
writeTo
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
info
Description copied from class:NodeNormally, you want to use one of the staticcreatemethods to implement this.For
QueryPlans, it is very important that the properties contain all of the expressions and references relevant to this node, and that all the properties are used in the provided constructor; otherwise query plan transformations likeQueryPlan#transformExpressionsOnly(Function)will not have an effect.- Specified by:
infoin classNode<LogicalPlan>
-
resolved
public boolean resolved()- Specified by:
resolvedin interfaceResolvable- Specified by:
resolvedin interfaceUnresolvable- Overrides:
resolvedin classLogicalPlan
-
expressionsResolved
public boolean expressionsResolved()- Specified by:
expressionsResolvedin classLogicalPlan
-
output
Description copied from class:QueryPlanThe 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.- Specified by:
outputin classQueryPlan<LogicalPlan>
-
unresolvedMessage
Description copied from interface:UnresolvableNOTE: Any non-null return value from this method indicates that the item in question could not be resolved.- Specified by:
unresolvedMessagein interfaceUnresolvable
-
hashCode
public int hashCode()- Specified by:
hashCodein classLogicalPlan
-
equals
- Specified by:
equalsin classLogicalPlan
-
nodeProperties
Description copied from class:NodeThe values of all the properties that are important to thisNode.- Overrides:
nodePropertiesin classNode<LogicalPlan>
-
toString
- Overrides:
toStringin classNode<LogicalPlan>
-