Class Completion
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.UnaryPlan
org.elasticsearch.xpack.esql.plan.logical.inference.InferencePlan<Completion>
org.elasticsearch.xpack.esql.plan.logical.inference.Completion
- All Implemented Interfaces:
NamedWriteable,Writeable,PostAnalysisVerificationAware,TelemetryAware,Resolvable,GeneratingPlan<InferencePlan<Completion>>,ExecutesOn,ExecutesOn.Coordinator,SortAgnostic,SortPreserving,Streaming,SurrogateLogicalPlan
public class Completion
extends InferencePlan<Completion>
implements TelemetryAware, PostAnalysisVerificationAware
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.xpack.esql.plan.logical.LogicalPlan
LogicalPlan.StageNested 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.plan.logical.inference.InferencePlan
ESQL_INFERENCE_ROW_LIMIT, INFERENCE_ID_OPTION_NAME, VALID_INFERENCE_OPTION_NAMESFields inherited from class org.elasticsearch.xpack.esql.core.tree.Node
TO_STRING_MAX_WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionCompletion(Source source, LogicalPlan p, Expression rowLimit, Expression prompt, Attribute targetField) Completion(Source source, LogicalPlan child, Expression inferenceId, Expression rowLimit, Expression prompt, Attribute targetField) -
Method Summary
Modifier and TypeMethodDescriptionprotected AttributeSetThis very likely needs to be overridden forQueryPlan.references()to be correct when inheriting.booleanbooleaninthashCode()protected NodeInfo<? extends LogicalPlan> info()Normally, you want to use one of the staticcreatemethods to implement this.booleanChecks if this InferencePlan is foldable (all input expressions are foldable).output()The ordered list of attributes (i.e.voidpostAnalysisVerification(Failures failures) Allows the implementer to validate itself.prompt()replaceChild(LogicalPlan newChild) taskType()withGeneratedNames(List<String> newNames) Create a new instance of this node with new outputAttributes using the given names.withInferenceId(Expression newInferenceId) voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.xpack.esql.plan.logical.inference.InferencePlan
inferenceId, rowLimit, surrogate, validOptionNames, withInferenceResolutionErrorMethods inherited from class org.elasticsearch.xpack.esql.plan.logical.UnaryPlan
child, inputSet, outputSet, 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, references, transformExpressionsDown, transformExpressionsDown, transformExpressionsOnly, transformExpressionsOnly, transformExpressionsOnlyUp, transformExpressionsUp, transformExpressionsUpMethods inherited from class org.elasticsearch.xpack.esql.core.tree.Node
anyMatch, children, collect, collect, collect, collectFirstChildren, collectLeaves, doCollectFirst, forEachDown, forEachDown, forEachDownMayReturnEarly, forEachProperty, forEachPropertyDown, forEachPropertyOnly, forEachPropertyUp, forEachUp, forEachUp, nodeName, nodeProperties, nodeString, propertiesToString, replaceChildrenSameSize, source, sourceLocation, sourceText, toString, transformChildren, transformDown, transformDown, transformDown, 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
executesOnMethods inherited from interface org.elasticsearch.xpack.esql.plan.GeneratingPlan
checkNumberOfNewNamesMethods inherited from interface org.elasticsearch.xpack.esql.capabilities.TelemetryAware
telemetryLabel
-
Field Details
-
DEFAULT_OUTPUT_FIELD_NAME
- See Also:
-
ENTRY
-
-
Constructor Details
-
Completion
public Completion(Source source, LogicalPlan p, Expression rowLimit, Expression prompt, Attribute targetField) -
Completion
public Completion(Source source, LogicalPlan child, Expression inferenceId, Expression rowLimit, Expression prompt, Attribute targetField) -
Completion
- Throws:
IOException
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classInferencePlan<Completion>- Throws:
IOException
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
prompt
-
targetField
-
withInferenceId
- Specified by:
withInferenceIdin classInferencePlan<Completion>
-
replaceChild
- Specified by:
replaceChildin classUnaryPlan
-
taskType
- Specified by:
taskTypein classInferencePlan<Completion>
-
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. -
generatedAttributes
- Specified by:
generatedAttributesin interfaceGeneratingPlan<InferencePlan<Completion>>
-
withGeneratedNames
Description copied from interface:GeneratingPlanCreate a new instance of this node with new outputAttributes using the given names. If an output attribute already has the desired name, we continue using it; otherwise, we create a new attribute with a newNameId.- Specified by:
withGeneratedNamesin interfaceGeneratingPlan<InferencePlan<Completion>>
-
computeReferences
Description copied from class:QueryPlanThis very likely needs to be overridden forQueryPlan.references()to be correct when inheriting. This can be called on unresolved plans and therefore must not rely on calls toQueryPlan.output().- Overrides:
computeReferencesin classQueryPlan<LogicalPlan>
-
expressionsResolved
public boolean expressionsResolved()- Overrides:
expressionsResolvedin classInferencePlan<Completion>
-
isFoldable
public boolean isFoldable()Description copied from class:InferencePlanChecks if this InferencePlan is foldable (all input expressions are foldable). A plan is foldable if all its input expressions can be evaluated statically.- Specified by:
isFoldablein classInferencePlan<Completion>
-
postAnalysisVerification
Description copied from interface:PostAnalysisVerificationAwareAllows the implementer to validate itself. This usually involves checking its internal setup, which often means checking the parameters it received on construction: their data or syntactic type, class, their count, expressions' structure etc. The discovered failures are added to the givenFailuresobject.It is often more useful to perform the checks as extended as it makes sense, over stopping at the first failure. This will allow the author to progress faster to a correct query.
Example: the
Filterclass, which models the WHERE command, checks that the expression it filters on -condition- is of a Boolean or NULL type:@Override void postAnalysisVerification(Failures failures) { if (condition.dataType() != NULL && condition.dataType() != BOOLEAN) { failures.add(fail(condition, "Condition expression needs to be boolean, found [{}]", condition.dataType())); } }- Specified by:
postAnalysisVerificationin interfacePostAnalysisVerificationAware- Parameters:
failures- the object to add failures to.
-
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>
-
equals
- Overrides:
equalsin classInferencePlan<Completion>
-
hashCode
public int hashCode()- Overrides:
hashCodein classInferencePlan<Completion>
-