Class DatasetShadowRelation

All Implemented Interfaces:
NamedWriteable, Writeable, Resolvable, Unresolvable

public class DatasetShadowRelation extends LeafPlan implements 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:

  1. Emitted during dataset rewriting (DatasetRewriter.rewriteOne) alongside the dataset's external relation, only under CPS for an exact (non-wildcard, flat) pattern.
  2. PreAnalyzer collects the pattern into the same linked-indices set ViewShadowRelation lands in, keyed by linkedIndexPattern().
  3. EsqlSession.preAnalyzeLinkedIndices issues 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 in AnalyzerContext.linkedResolution, keyed by linkedIndexPattern().
  4. The ResolveDatasetShadow analyzer rule (sibling of ResolveViewShadow) replaces the shadow with an EsRelation on a valid resolution, else leaves it unresolved.
  5. StripDatasetShadowRelations removes any still-unresolved shadow; a single-survivor union collapses to its lone child.