Class DatasetShadowRelation
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.DatasetShadowRelation
- All Implemented Interfaces:
NamedWriteable,Writeable,Resolvable,Unresolvable
Marker leaf node that represents an exact dataset name being looked up on linked projects (CPS) as
a potential remote index with the same name as a local dataset. The dataset analog of
ViewShadowRelation: it rides next to the dataset's UnresolvedExternalRelation inside
the plain UnionAll the DatasetRewriter builds.
Motivation: FROM ds where ds is BOTH a local dataset AND a remote dataset/index. The
local dataset is consumed before field-caps, and DatasetRewriter.crossProjectPatternsToPreserve
only re-emits a sibling for wildcards — an exact name returns nothing, so without this shadow
the remote half of the exact name never reaches field-caps.
Lifecycle, mirroring ViewShadowRelation:
- Emitted during dataset rewriting (
DatasetRewriter.rewriteOne) alongside the dataset's external relation, only under CPS for an exact (non-wildcard, flat) pattern. PreAnalyzercollects the pattern into the same linked-indices setViewShadowRelationlands in, keyed bylinkedIndexPattern().EsqlSession.preAnalyzeLinkedIndicesissues a lenient flat field-caps request per pattern; a linked index of the same name resolves, a linked dataset/view fails on the detect rail. Results land inAnalyzerContext.linkedResolution, keyed bylinkedIndexPattern().- The
ResolveDatasetShadowanalyzer rule (sibling ofResolveViewShadow) replaces the shadow with anEsRelationon a valid resolution, else leaves it unresolved. StripDatasetShadowRelationsremoves any still-unresolved shadow; a single-survivor union collapses to its lone child.
-
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
ConstructorsConstructorDescriptionDatasetShadowRelation(Source source, String datasetName, LinkedIndexPattern.Kind kind, String pattern) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleaninthashCode()protected NodeInfo<DatasetShadowRelation> 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.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
-
DatasetShadowRelation
public DatasetShadowRelation(Source source, String datasetName, LinkedIndexPattern.Kind kind, String pattern)
-
-
Method Details
-
datasetName
-
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>
-