Class Alias
java.lang.Object
org.elasticsearch.xpack.esql.core.tree.Node<Expression>
org.elasticsearch.xpack.esql.core.expression.Expression
org.elasticsearch.xpack.esql.core.expression.NamedExpression
org.elasticsearch.xpack.esql.core.expression.Alias
- All Implemented Interfaces:
NamedWriteable,Writeable,Resolvable
An
Alias is a NamedExpression that gets renamed to something else through the Alias.
For example, in the statement 5 + 2 AS x, x is an alias which is points to ADD(5, 2).
And in SELECT col AS x "col" is a named expression that gets renamed to "x" through an alias.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
Expression.TypeResolutionNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAlias(StreamInput in) Alias(Source source, String name, Expression child) Alias(Source source, String name, Expression child, NameId id) Alias(Source source, String name, Expression child, NameId id, boolean synthetic) -
Method Summary
Modifier and TypeMethodDescriptionchild()dataType()TheDataTypereturned by executing the tree rooted at this expression.info()Return the information about this node.nullable()replaceChild(Expression child) replaceChildren(List<Expression> newChildren) protected Expression.TypeResolutionThe implementation ofExpression.typeResolved(), which is just a caching wrapper around this method.toString()static Expressionunwrap(Expression e) If the given expression is an alias, return its child - otherwise return as is.voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.xpack.esql.core.expression.NamedExpression
equals, hashCode, id, innerEquals, name, syntheticMethods inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
canonical, canonicalize, childrenResolved, fold, foldable, propertiesToString, references, resolved, semanticEquals, semanticHash, typeResolvedMethods inherited from class org.elasticsearch.xpack.esql.core.tree.Node
anyMatch, children, collect, collectFirstChildren, collectLeaves, doCollectFirst, forEachDown, forEachDown, forEachProperty, forEachPropertyDown, forEachPropertyOnly, forEachPropertyUp, forEachUp, forEachUp, nodeName, nodeProperties, replaceChildrenSameSize, source, sourceLocation, sourceText, transformChildren, transformDown, transformDown, transformDown, transformNodeProps, transformPropertiesDown, transformPropertiesOnly, transformPropertiesUp, transformUp, transformUp, transformUp
-
Field Details
-
ENTRY
-
-
Constructor Details
-
Alias
-
Alias
-
Alias
-
Alias
- Throws:
IOException
-
-
Method Details
-
writeTo
- Throws:
IOException
-
getWriteableName
-
info
Description copied from class:NodeReturn the information about this node.Normally, you want to use one of the static
createmethods 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 of the properties are used in the provided constructor; otherwise query plan transformations likeQueryPlan#transformExpressionsOnly(Function)will not have an effect.- Specified by:
infoin classNode<Expression>
-
replaceChild
-
replaceChildren
- Specified by:
replaceChildrenin classNode<Expression>
-
child
-
nullable
- Specified by:
nullablein classExpression
-
resolveType
Description copied from class:ExpressionThe implementation ofExpression.typeResolved(), which is just a caching wrapper around this method. See it's javadoc for what this method should return.Implementations will rarely interact with the
Expression.TypeResolutionclass directly, instead usually calling the utility methods onTypeResolutions.Implementations should fail if
Expression.childrenResolved()returnsfalse.- Overrides:
resolveTypein classExpression
-
dataType
Description copied from class:ExpressionTheDataTypereturned by executing the tree rooted at this expression. IfExpression.typeResolved()returns an error then the behavior of this method is undefined. It may return a valid type. Or it may throw an exception. Or it may return a totally nonsensical type.- Specified by:
dataTypein classExpression
-
toAttribute
Description copied from class:NamedExpressionTry to return eitherthisif it is anAttribute, or aReferenceAttributeto it otherwise. Return anUnresolvedAttributeif this is unresolved.- Specified by:
toAttributein classNamedExpression
-
toString
- Overrides:
toStringin classNamedExpression
-
nodeString
- Overrides:
nodeStringin classNamedExpression
-
unwrap
If the given expression is an alias, return its child - otherwise return as is.
-