class LateralColumnAliasResolver extends QueryErrorsBase
Handles resolution of lateral column references in Project and Aggregate operators.
- Alphabetic
- By Inheritance
- LateralColumnAliasResolver
- QueryErrorsBase
- DataTypeErrorsBase
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new LateralColumnAliasResolver(expressionResolver: ExpressionResolver)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- 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.
iterationStartis 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 inupdateAliasTrees).remappedAliasesshould be None if we are resolving LCAs in Project. originalProjectListis 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 (attrasname) 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
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def getQueryContext(context: QueryContext): Array[QueryContext]
- Definition Classes
- DataTypeErrorsBase
- def getSummary(sqlContext: QueryContext): String
- Definition Classes
- DataTypeErrorsBase
- 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
buildProjectWithResolvedLcato 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
- 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
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def ordinalNumber(i: Int): String
- Definition Classes
- QueryErrorsBase
- def quoteByDefault(elem: String): String
- Attributes
- protected[sql]
- Definition Classes
- DataTypeErrorsBase
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toDSOption(option: String): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLConf(conf: String): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLConfVal(conf: String): String
- Definition Classes
- QueryErrorsBase
- def toSQLExpr(e: Expression): String
- Definition Classes
- QueryErrorsBase
- def toSQLId(parts: Seq[String]): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLId(parts: String): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLStmt(text: String): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLType(t: AbstractDataType): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLType(text: String): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLValue(v: Any, t: DataType): String
- Definition Classes
- QueryErrorsBase
- def toSQLValue(value: Double): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLValue(value: Float): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLValue(value: Long): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLValue(value: Int): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLValue(value: Short): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLValue(value: UTF8String): String
- Definition Classes
- DataTypeErrorsBase
- def toSQLValue(value: String): String
- Definition Classes
- DataTypeErrorsBase
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)