Class NamedExpression

All Implemented Interfaces:
NamedWriteable, Writeable, Resolvable
Direct Known Subclasses:
Alias, Attribute, UnresolvedNamedExpression

public abstract class NamedExpression extends Expression implements NamedWriteable
An expression that has a name. Named expressions can be used as a result (by converting to an attribute).
  • Constructor Details

  • Method Details

    • name

      public String name()
    • id

      public NameId 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

      public abstract Attribute toAttribute()
      Try to return either this if it is an Attribute, or a ReferenceAttribute to it otherwise. Return an UnresolvedAttribute if this is unresolved.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Node<Expression>
    • equals

      public final boolean equals(Object o)
      Polymorphic equality is a pain and are likely slower than a regular ones. This equals shortcuts `this == o` and type checks (important when we expect only a few non-equal objects). Here equals is final to ensure we are not duplicating those checks. For actual equality check override `innerEquals` instead.
      Overrides:
      equals in class Node<Expression>
    • innerEquals

      protected boolean innerEquals(Object o)
    • toString

      public String toString()
      Overrides:
      toString in class Expression
    • nodeString

      public String nodeString()
      Overrides:
      nodeString in class Node<Expression>