Packages

c

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

LateralColumnAliasResolver

class LateralColumnAliasResolver extends QueryErrorsBase

Handles resolution of lateral column references in Project and Aggregate operators.

Linear Supertypes
QueryErrorsBase, DataTypeErrorsBase, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LateralColumnAliasResolver
  2. QueryErrorsBase
  3. DataTypeErrorsBase
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new LateralColumnAliasResolver(expressionResolver: ExpressionResolver)

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 buildProjectWithResolvedLca(resolvedChild: LogicalPlan, scope: NameScope, originalProjectList: Seq[NamedExpression], firstIterationProjectList: Seq[NamedExpression], remappedAliases: Option[HashMap[ExprId, Alias]] = None, aliasesToCollect: ArrayBuffer[Alias] = ArrayBuffer.empty): Project

    Builds a multi-level Project with all lateral column aliases and their dependencies.

    Builds a multi-level Project with all lateral column aliases and their dependencies. First, from top scope, we acquire dependency levels of all aliases. Dependency level is defined as a number of attributes that an attribute depends on in the lateral alias reference chain. For example, in a query like:

    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

    Dependency levels will be as follows:

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

    Once we have dependency levels, we construct a multi-level Project in a following way:

    • There is exactly one Project node per level.
    • Project lists are compounded such that project lists on upper levels must contain all attributes from the below levels.
    • iterationStart is the project list on level 0.
    • In each iteration, if we are resolving LCAs from Aggregate, we need to update aliases in the project list based on remappedAliases (detailed description in updateAliasTrees). remappedAliases should be None if we are resolving LCAs in Project.
    • originalProjectList is placed on top of the multi-level Project. Any aliases that have been laterally referenced need to be replaced with only their names. This is because their full definitions ( attr as name ) have already been defined on lower levels.
    • If an attribute is never referenced, it does not show up in multi-level project lists, but instead only in the top-most Project.
    • Additionally, collect all aliases from newly created Project nodes and add them to aliasesToCollect.

    For previously given query, following above rules, resolved Project would look like:

    Project [a, b, 2 AS c, d, a AS e, d AS f, g, h, h AS i] +- Project [a, b, d, g, g AS h] +- Project [a, b, b AS d, a AS g] +- Project [0 AS a, 1 AS b] +- OneRowRelation

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  10. def getQueryContext(context: QueryContext): Array[QueryContext]
    Definition Classes
    DataTypeErrorsBase
  11. def getSummary(sqlContext: QueryContext): String
    Definition Classes
    DataTypeErrorsBase
  12. def handleLcaInAggregate(resolvedAggregate: Aggregate): AggregateWithLcaResolutionResult

    Handles lateral column references in Aggregate operator by doing the following:

    Handles lateral column references in Aggregate operator by doing the following:

    • Replaces the original Aggregate with a Project(Aggregate) structure in order to eliminate lateral column references from the Aggregate (detailed description can be found in extractLcaAndReplaceAggWithProject).
    • Asserts that the newly created Aggregate is valid.
    • Because the new Project now contains lateral column references, call buildProjectWithResolvedLca to resolve LCAs in the Project.
    • Set the flag in the current NameScope that we have an LCA in Aggregate operator.
    • In order to be able to resolve Sort on top of an Aggregate that has LCAs, we need to collect all aliases from Aggregate, as well as any aliases from artificially inserted Project nodes.
    • Collects all aliases from newly created Aggregate and Project nodes and adds them to aliasesToCollect
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  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. def ordinalNumber(i: Int): String
    Definition Classes
    QueryErrorsBase
  19. def quoteByDefault(elem: String): String
    Attributes
    protected[sql]
    Definition Classes
    DataTypeErrorsBase
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toDSOption(option: String): String
    Definition Classes
    DataTypeErrorsBase
  22. def toSQLConf(conf: String): String
    Definition Classes
    DataTypeErrorsBase
  23. def toSQLConfVal(conf: String): String
    Definition Classes
    QueryErrorsBase
  24. def toSQLExpr(e: Expression): String
    Definition Classes
    QueryErrorsBase
  25. def toSQLId(parts: Seq[String]): String
    Definition Classes
    DataTypeErrorsBase
  26. def toSQLId(parts: String): String
    Definition Classes
    DataTypeErrorsBase
  27. def toSQLStmt(text: String): String
    Definition Classes
    DataTypeErrorsBase
  28. def toSQLType(t: AbstractDataType): String
    Definition Classes
    DataTypeErrorsBase
  29. def toSQLType(text: String): String
    Definition Classes
    DataTypeErrorsBase
  30. def toSQLValue(v: Any, t: DataType): String
    Definition Classes
    QueryErrorsBase
  31. def toSQLValue(value: Double): String
    Definition Classes
    DataTypeErrorsBase
  32. def toSQLValue(value: Float): String
    Definition Classes
    DataTypeErrorsBase
  33. def toSQLValue(value: Long): String
    Definition Classes
    DataTypeErrorsBase
  34. def toSQLValue(value: Int): String
    Definition Classes
    DataTypeErrorsBase
  35. def toSQLValue(value: Short): String
    Definition Classes
    DataTypeErrorsBase
  36. def toSQLValue(value: UTF8String): String
    Definition Classes
    DataTypeErrorsBase
  37. def toSQLValue(value: String): String
    Definition Classes
    DataTypeErrorsBase
  38. def toString(): String
    Definition Classes
    AnyRef → Any
  39. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  40. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  41. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

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 QueryErrorsBase

Inherited from DataTypeErrorsBase

Inherited from AnyRef

Inherited from Any

Ungrouped