Class ExternalRelation
- All Implemented Interfaces:
NamedWriteable,Writeable,Resolvable,ExecutesOn,ExecutesOn.Coordinator
Like EsRelation, the Mapper wraps this into a FragmentExec
so that pipeline breakers (Aggregate, Limit, TopN) above it are distributed to data nodes
via ExchangeExec. On data nodes, localPlan() expands the FragmentExec through
LocalMapper into ExternalSourceExec, enabling local optimizations such as
filter pushdown via FormatReader.filterPushdownSupport().
The ExecutesOn.Coordinator marker is retained for logical plan validation
(e.g., Enrich/Join hoist rules that inspect whether a relation executes on the coordinator).
The source-specific metadata is stored in the SourceMetadata interface, which
provides:
- ExternalSchema attributes via
SourceMetadata.schema() - Source type via
SourceMetadata.sourceType() - Configuration via
SourceMetadata.config() - Opaque source metadata via
SourceMetadata.sourceMetadata()
The toPhysicalExec() method creates a generic ExternalSourceExec that
carries all necessary information for the operator factory to create the appropriate
source operator via the SPI.
-
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.xpack.esql.plan.logical.ExecutesOn
ExecutesOn.Coordinator, ExecutesOn.ExecuteLocation, ExecutesOn.RemoteNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields inherited from class org.elasticsearch.xpack.esql.core.tree.Node
TO_STRING_MAX_LINES, TO_STRING_MAX_WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionExternalRelation(Source source, String sourcePath, SourceMetadata metadata, List<Attribute> output, FileList fileList, Map<StoragePath, SchemaReconciliation.FileSchemaInfo> schemaMap) ExternalRelation(Source source, String sourcePath, SourceMetadata metadata, List<Attribute> output, FileList fileList, Map<StoragePath, SchemaReconciliation.FileSchemaInfo> schemaMap, String datasetName) ExternalRelation(Source source, String sourcePath, SourceMetadata metadata, List<Attribute> output, FileList fileList, Map<StoragePath, SchemaReconciliation.FileSchemaInfo> schemaMap, String datasetName, List<? extends NamedExpression> metadataFields, DeclaredReadSpec declaredReadSpec) -
Method Summary
Modifier and TypeMethodDescriptionRegistered dataset identifier, ornullwhen this relation was produced by the inlineEXTERNALcommand path.The declared mapping's read-instructions (renames,_id.path, per-column date formats), orDeclaredReadSpec.NONE.booleanbooleanfileList()inthashCode()protected NodeInfo<ExternalRelation> info()Normally, you want to use one of the staticcreatemethods to implement this.metadata()List<? extends NamedExpression> METADATA clause expressions threaded through from the parser.The values of all the properties that are important to thisNode.voidnodeString(StringBuilder sb, Node.NodeStringFormat format, NodeStringMapper mapper) Append thisNode's string representation tosb.output()The ordered list of attributes (i.e.withAttributes(List<Attribute> newAttributes) 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, resolved, 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, propertiesToString, replaceChildrenSameSize, source, sourceLocation, sourceText, toString, toString, toString, transformChildren, transformChildren, transformDown, transformDown, transformDown, transformDown, transformDownSkipBranch, transformNodeProps, transformPropertiesDown, transformPropertiesOnly, transformPropertiesUp, transformUp, transformUp, transformUpMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xpack.esql.plan.logical.ExecutesOn.Coordinator
executesOn
-
Field Details
-
ENTRY
-
-
Constructor Details
-
ExternalRelation
public ExternalRelation(Source source, String sourcePath, SourceMetadata metadata, List<Attribute> output, FileList fileList, Map<StoragePath, SchemaReconciliation.FileSchemaInfo> schemaMap) -
ExternalRelation
public ExternalRelation(Source source, String sourcePath, SourceMetadata metadata, List<Attribute> output, FileList fileList, Map<StoragePath, SchemaReconciliation.FileSchemaInfo> schemaMap, @Nullable String datasetName) -
ExternalRelation
public ExternalRelation(Source source, String sourcePath, SourceMetadata metadata, List<Attribute> output, FileList fileList, Map<StoragePath, SchemaReconciliation.FileSchemaInfo> schemaMap, @Nullable String datasetName, List<? extends NamedExpression> metadataFields, DeclaredReadSpec declaredReadSpec)
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
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>
-
sourcePath
-
metadata
-
fileList
-
schemaMap
-
datasetName
Registered dataset identifier, ornullwhen this relation was produced by the inlineEXTERNALcommand path. Carried toExternalSourceExecviatoPhysicalExec(). -
declaredReadSpec
The declared mapping's read-instructions (renames,_id.path, per-column date formats), orDeclaredReadSpec.NONE. Carried toExternalSourceExecviatoPhysicalExec(). -
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>
-
expressionsResolved
public boolean expressionsResolved()- Specified by:
expressionsResolvedin classLogicalPlan
-
metadataFields
METADATA clause expressions threaded through from the parser. Resolved entries are bound intooutput; unresolved entries (typo'd or unknown names) stay here so the verifier'scheckUnresolvedAttributeswalk picks them up and reports the indexed-equivalent"Unresolved metadata pattern [...]"error. -
sourceType
-
toPhysicalExec
-
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>
-
nodeString
Description copied from class:Node- Overrides:
nodeStringin classNode<LogicalPlan>- Parameters:
sb- target for the stringformat- output-shape configuration (width / lines / property count)mapper- identifier-mapping strategy (raw viaNodeStringMapper.IDENTITY, anonymized via the failure-path anonymizer, etc.)
-
withAttributes
-