Packages

c

org.apache.spark.sql.catalyst.analysis.resolver

LateralColumnAliasRegistryImpl

class LateralColumnAliasRegistryImpl extends LateralColumnAliasRegistry

LateralColumnAliasRegistryImpl is a utility class that contains structures required for lateral column alias resolution. Here we store:

  • currentAttributeDependencyLevelStack - Current attribute dependency level in the scope. Dependency level is defined as a maximum dependency in that attribute's expression tree. For example, in a query like:
SELECT a, b, a + b AS c, a + c AS d

Dependency levels will be as follows: level 0: a, b level 1: c level 2: d

We add a new entry to the stack for each new Alias resolution. This is needed because we can have nesting Aliases in the plan, that do not belong to the same LCA scope. For example, in the following query:

SELECT STRUCT('alpha' AS A, 'beta' AS B) ST

ST, A and B would be aliases in the same expression tree, but they do not belong in the same LCA scope.

  • availableAttributes - All attributes that can be laterally referenced. This map is indexed by name, but contains a list of attributes with the same name. This is because it is possible to have multiple attributes with the same name in the scope, but they can't be laterally referenced. Handling ambiguous references is done in the getAttribute method. For the following query:
SELECT 0 AS a, 1 AS b, 2 AS c, b AS d, a AS e, d AS f, a AS g, g AS h, h AS i

availableAttributes will be: {a, b, c, d, e, f, g, h, i}

  • referencedAliases - Aliases that have been laterally referenced. For the given query example, referencedAliases will be: {a, b, d, g, h}
  • aliasDependencyLevels - Dependency levels of all aliases, indexed by dependency level. For the given query example, dependency levels will be as follows:

level 0: a, b, c level 1: d, e, g level 2: f, h level 3: i

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LateralColumnAliasRegistryImpl
  2. LateralColumnAliasRegistry
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new LateralColumnAliasRegistryImpl(attributes: Seq[Attribute])

    attributes

    Output attributes from currently resolved NameScope, to which the registry belongs.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def getAliasDependencyLevels(): ArrayList[ArrayList[Alias]]

    Returns the dependency levels of all aliases.

    Returns the dependency levels of all aliases.

    Definition Classes
    LateralColumnAliasRegistryImplLateralColumnAliasRegistry
  9. def getAttribute(attributeName: String): Option[Attribute]

    Gets the attribute needed for LCA resolution by given name from the set of available attributes.

    Gets the attribute needed for LCA resolution by given name from the set of available attributes. If there are multiple matches, throws ambiguousLateralColumnAliasError error. If the method is called while resolving an Alias, updates the dependency level in the current scope.

    Definition Classes
    LateralColumnAliasRegistryImplLateralColumnAliasRegistry
  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  12. def isAttributeLaterallyReferenced(attribute: Attribute): Boolean

    Returns true if the attribute has been laterally referenced, false otherwise.

    Returns true if the attribute has been laterally referenced, false otherwise.

    Definition Classes
    LateralColumnAliasRegistryImplLateralColumnAliasRegistry
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def markAttributeLaterallyReferenced(attribute: Attribute): Unit

    Adds an attribute to the set of attributes that have been laterally referenced.

    Adds an attribute to the set of attributes that have been laterally referenced.

    Definition Classes
    LateralColumnAliasRegistryImplLateralColumnAliasRegistry
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  18. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  19. def throwLcaResolutionNotEnabled(): Nothing
    Attributes
    protected
    Definition Classes
    LateralColumnAliasRegistry
  20. def toString(): String
    Definition Classes
    AnyRef → Any
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. def withNewLcaScope(body: => Alias): Alias

    Creates a new LCA resolution scope for each Alias resolution.

    Creates a new LCA resolution scope for each Alias resolution. Executes the lambda and registers the resolved alias for later LCA resolution.

    Definition Classes
    LateralColumnAliasRegistryImplLateralColumnAliasRegistry

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped