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
AliasHelper, ColumnResolutionHelper, DataTypeErrorsBase, Logging, SQLConfHelper, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ResolveReferencesInAggregate
  2. AliasHelper
  3. ColumnResolutionHelper
  4. DataTypeErrorsBase
  5. Logging
  6. SQLConfHelper
  7. AnyRef
  8. 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 getQueryContext(sqlContext: SQLQueryContext): Array[QueryContext]
    Definition Classes
    DataTypeErrorsBase
  17. def getSummary(sqlContext: SQLQueryContext): String
    Definition Classes
    DataTypeErrorsBase
  18. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  19. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  20. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  21. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  22. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  23. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  24. def logDebug(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  25. def logDebug(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  26. def logError(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  27. def logError(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  28. def logInfo(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  29. def logInfo(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  30. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  31. def logTrace(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  32. def logTrace(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  33. def logWarning(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  34. def logWarning(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  35. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  36. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  37. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  38. def quoteByDefault(elem: String): String
    Attributes
    protected
    Definition Classes
    DataTypeErrorsBase
  39. 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
  40. 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
  41. def resolveColWithAgg(e: Expression, plan: LogicalPlan): Expression
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  42. def resolveExprInAssignment(expr: Expression, hostPlan: LogicalPlan): Expression
    Definition Classes
    ColumnResolutionHelper
  43. 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
  44. 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
  45. 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
  46. def resolveLateralColumnAlias(selectList: Seq[Expression]): Seq[Expression]
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  47. def resolveOuterRef(e: Expression): Expression
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  48. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  49. def toSQLConf(conf: String): String
    Definition Classes
    DataTypeErrorsBase
  50. def toSQLId(parts: Seq[String]): String
    Definition Classes
    DataTypeErrorsBase
  51. def toSQLId(parts: String): String
    Definition Classes
    DataTypeErrorsBase
  52. def toSQLStmt(text: String): String
    Definition Classes
    DataTypeErrorsBase
  53. def toSQLType(t: AbstractDataType): String
    Definition Classes
    DataTypeErrorsBase
  54. def toSQLType(text: String): String
    Definition Classes
    DataTypeErrorsBase
  55. def toSQLValue(value: Double): String
    Definition Classes
    DataTypeErrorsBase
  56. def toSQLValue(value: Float): String
    Definition Classes
    DataTypeErrorsBase
  57. def toSQLValue(value: Long): String
    Definition Classes
    DataTypeErrorsBase
  58. def toSQLValue(value: Int): String
    Definition Classes
    DataTypeErrorsBase
  59. def toSQLValue(value: Short): String
    Definition Classes
    DataTypeErrorsBase
  60. def toSQLValue(value: UTF8String): String
    Definition Classes
    DataTypeErrorsBase
  61. def toSQLValue(value: String): String
    Definition Classes
    DataTypeErrorsBase
  62. def toString(): String
    Definition Classes
    AnyRef → Any
  63. def trimAliases(e: Expression): Expression
    Attributes
    protected
    Definition Classes
    AliasHelper
  64. def trimNonTopLevelAliases[T <: Expression](e: T): T
    Attributes
    protected
    Definition Classes
    AliasHelper
  65. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  66. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  67. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AliasHelper

Inherited from ColumnResolutionHelper

Inherited from DataTypeErrorsBase

Inherited from Logging

Inherited from SQLConfHelper

Inherited from AnyRef

Inherited from Any

Ungrouped