Packages

o

org.apache.spark.sql.catalyst.analysis

ResolveReferencesInAggregate

object ResolveReferencesInAggregate extends SQLConfHelper with ColumnResolutionHelper with AliasHelper

A virtual rule to resolve UnresolvedAttribute in Aggregate. It's only used by the real rule ResolveReferences. The column resolution order for Aggregate is: 1. Resolves the columns to AttributeReference with the output of the child plan. This includes metadata columns as well. 2. Resolves the columns to a literal function which is allowed to be invoked without braces, e.g. SELECT col, current_date FROM t. 3. If aggregate expressions are all resolved, resolve GROUP BY alias and GROUP BY ALL. 3.1. If the grouping expressions contain an unresolved column whose name matches an alias in the SELECT list, resolves that unresolved column to the alias. This is to support SQL pattern like SELECT a + b AS c, max(col) FROM t GROUP BY c. 3.2. If the grouping expressions only have one single unresolved column named 'ALL', expanded it to include all non-aggregate columns in the SELECT list. This is to support SQL pattern like SELECT col1, col2, agg_expr(...) FROM t GROUP BY ALL. 4. Resolves the columns in aggregate expressions to LateralColumnAliasReference if it references the alias defined previously in the SELECT list. The rule ResolveLateralColumnAliasReference will further resolve LateralColumnAliasReference and rewrite the plan. This is to support SQL pattern like SELECT col1 + 1 AS x, x + 1 AS y, y + 1 AS z FROM t. 5. Resolves the columns to outer references with the outer plan if we are resolving subquery expressions.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ResolveReferencesInAggregate
  2. AliasHelper
  3. ColumnResolutionHelper
  4. Logging
  5. SQLConfHelper
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

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. def apply(a: Aggregate): Aggregate
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def checkUnresolvedGroupByAll(operator: LogicalPlan): Unit

    A check to be used in CheckAnalysis to see if we have any unresolved group by at the end of analysis, so we can tell users that we fail to infer the grouping columns.

  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. def conf: SQLConf

    The active config object within the current scope.

    The active config object within the current scope. See SQLConf.get for more information.

    Definition Classes
    SQLConfHelper
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  12. def getAliasMap(exprs: Seq[NamedExpression]): AttributeMap[Alias]
    Attributes
    protected
    Definition Classes
    AliasHelper
  13. def getAliasMap(plan: Aggregate): AttributeMap[Alias]
    Attributes
    protected
    Definition Classes
    AliasHelper
  14. def getAliasMap(plan: Project): AttributeMap[Alias]
    Attributes
    protected
    Definition Classes
    AliasHelper
  15. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  18. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  21. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  22. def logDebug(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  23. def logDebug(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  24. def logError(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  25. def logError(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  26. def logInfo(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  27. def logInfo(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  28. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  29. def logTrace(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  30. def logTrace(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  31. def logWarning(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  32. def logWarning(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  33. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  34. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  35. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  36. def replaceAlias(expr: Expression, aliasMap: AttributeMap[Alias]): Expression

    Replace all attributes, that reference an alias, with the aliased expression

    Replace all attributes, that reference an alias, with the aliased expression

    Attributes
    protected
    Definition Classes
    AliasHelper
  37. def replaceAliasButKeepName(expr: NamedExpression, aliasMap: AttributeMap[Alias]): NamedExpression

    Replace all attributes, that reference an alias, with the aliased expression, but keep the name of the outermost attribute.

    Replace all attributes, that reference an alias, with the aliased expression, but keep the name of the outermost attribute.

    Attributes
    protected
    Definition Classes
    AliasHelper
  38. def resolveColWithAgg(e: Expression, plan: LogicalPlan): Expression
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  39. def resolveExpressionByPlanChildren(e: Expression, q: LogicalPlan, allowOuter: Boolean = false): Expression

    Resolves UnresolvedAttribute, GetColumnByOrdinal and extract value expressions(s) by the input plan's children output attributes.

    Resolves UnresolvedAttribute, GetColumnByOrdinal and extract value expressions(s) by the input plan's children output attributes.

    e

    The expression need to be resolved.

    q

    The LogicalPlan whose children are used to resolve expression's attribute.

    returns

    resolved Expression.

    Definition Classes
    ColumnResolutionHelper
  40. def resolveExpressionByPlanOutput(expr: Expression, plan: LogicalPlan, throws: Boolean = false, allowOuter: Boolean = false): Expression

    Resolves UnresolvedAttribute, GetColumnByOrdinal and extract value expressions(s) by the input plan's output attributes.

    Resolves UnresolvedAttribute, GetColumnByOrdinal and extract value expressions(s) by the input plan's output attributes. In order to resolve the nested fields correctly, this function makes use of throws parameter to control when to raise an AnalysisException.

    Example : SELECT * FROM t ORDER BY a.b

    In the above example, after a is resolved to a struct-type column, we may fail to resolve b if there is no such nested field named "b". We should not fail and wait for other rules to resolve it if possible.

    Definition Classes
    ColumnResolutionHelper
  41. def resolveExprsAndAddMissingAttrs(exprs: Seq[Expression], plan: LogicalPlan): (Seq[Expression], LogicalPlan)

    This method tries to resolve expressions and find missing attributes recursively.

    This method tries to resolve expressions and find missing attributes recursively. Specifically, when the expressions used in Sort or Filter contain unresolved attributes or resolved attributes which are missing from child output. This method tries to find the missing attributes and add them into the projection.

    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  42. def resolveLateralColumnAlias(selectList: Seq[Expression]): Seq[Expression]
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  43. def resolveOuterRef(e: Expression): Expression
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  44. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  45. def toString(): String
    Definition Classes
    AnyRef → Any
  46. def trimAliases(e: Expression): Expression
    Attributes
    protected
    Definition Classes
    AliasHelper
  47. def trimNonTopLevelAliases[T <: Expression](e: T): T
    Attributes
    protected
    Definition Classes
    AliasHelper
  48. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  49. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  50. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AliasHelper

Inherited from ColumnResolutionHelper

Inherited from Logging

Inherited from SQLConfHelper

Inherited from AnyRef

Inherited from Any

Ungrouped