Class NamedExpression
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
- All Implemented Interfaces:
NamedWriteable,Writeable,Resolvable
- Direct Known Subclasses:
Alias,Attribute,UnresolvedNamedExpression
An expression that has a name. Named expressions can be used as a result
(by converting to an attribute).
-
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 inherited from class org.elasticsearch.xpack.esql.core.tree.Node
TO_STRING_MAX_WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionNamedExpression(Source source, String name, List<Expression> children, NameId id) NamedExpression(Source source, String name, List<Expression> children, NameId id, boolean synthetic) Assigns a new id if null is passed forid. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanfinal booleanPolymorphic equality is a pain and can be slow.final inthashCode()final inthashCode(boolean ignoreIds) id()protected booleaninnerEquals(Object o, boolean ignoreIds) The actual equality check, after shortcuttingthis == oand class checks.protected intinnerHashCode(boolean ignoreIds) name()booleanSynthetic named expressions are not user defined and usually created during optimizations and substitutions, e.g.abstract AttributetoString()Methods inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
canonical, canonicalize, childrenResolved, dataType, fold, foldable, nullable, propertiesToString, references, resolved, resolveType, semanticEquals, semanticHash, typeResolvedMethods inherited from class org.elasticsearch.xpack.esql.core.tree.Node
anyMatch, children, collect, collectFirstChildren, collectLeaves, doCollectFirst, forEachDown, forEachDown, forEachDownMayReturnEarly, forEachProperty, forEachPropertyDown, forEachPropertyOnly, forEachPropertyUp, forEachUp, forEachUp, info, nodeName, nodeProperties, replaceChildren, replaceChildrenSameSize, source, sourceLocation, sourceText, 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.common.io.stream.NamedWriteable
getWriteableName
-
Constructor Details
-
NamedExpression
-
NamedExpression
public NamedExpression(Source source, String name, List<Expression> children, @Nullable NameId id, boolean synthetic) Assigns a new id if null is passed forid.
-
-
Method Details
-
name
-
id
-
synthetic
public boolean synthetic()Synthetic named expressions are not user defined and usually created during optimizations and substitutions, e.g. when turning... | STATS x = avg(2*field)into... | EVAL $$synth$attribute = 2*field | STATS x = avg($$synth$attribute). -
toAttribute
Try to return eitherthisif it is anAttribute, or aReferenceAttributeto it otherwise. Return anUnresolvedAttributeif this is unresolved. -
hashCode
public final int hashCode()- Overrides:
hashCodein classNode<Expression>
-
hashCode
public final int hashCode(boolean ignoreIds) -
innerHashCode
protected int innerHashCode(boolean ignoreIds) -
equals
- Overrides:
equalsin classNode<Expression>
-
equals
Polymorphic equality is a pain and can be slow. This shortcutsthis == oand class checks (important when we expect only a few non-equal objects).For the actual equality check override
innerEquals(Object, boolean)instead.We also provide the option to ignore NameIds in the equality check, which helps e.g. when creating named expressions while avoiding duplicates, or when attaching failures to unresolved attributes (see Failure.equals). Some classes will always ignore ids, irrespective of the parameter passed here.
-
innerEquals
The actual equality check, after shortcuttingthis == oand class checks. -
toString
- Overrides:
toStringin classExpression
-
nodeString
- Overrides:
nodeStringin classNode<Expression>
-