Packages

c

org.apache.spark.sql.catalyst.analysis

ResolveReferencesInSort

class ResolveReferencesInSort extends SQLConfHelper with ColumnResolutionHelper

A virtual rule to resolve UnresolvedAttribute in Sort. It's only used by the real rule ResolveReferences. The column resolution order for Sort is: 1. Resolves the column to AttributeReference with the output of the child plan. This includes metadata columns as well. 2. Resolves the column to a literal function which is allowed to be invoked without braces, e.g. SELECT col, current_date FROM t. 3. If the child plan is Aggregate, resolves the column to TempResolvedColumn with the output of Aggregate's child plan. This is to allow Sort to host grouping expressions and aggregate functions, which can be pushed down to the Aggregate later. For example, SELECT max(a) FROM t GROUP BY b ORDER BY min(a). 4. Resolves the column to AttributeReference with the output of a descendant plan node. Spark will propagate the missing attributes from the descendant plan node to the Sort node. This is to allow users to ORDER BY columns that are not in the SELECT clause, which is widely supported in other SQL dialects. For example, SELECT a FROM t ORDER BY b. 5. If the order by expressions only have one single unresolved column named ALL, expanded it to include all columns in the SELECT list. This is to support SQL pattern like SELECT col1, col2 FROM t ORDER BY ALL. This should also support specifying asc/desc, and nulls first/last. 6. Resolves the column to outer references with the outer plan if we are resolving subquery expressions.

Note, 3 and 4 are actually orthogonal. If the child plan is Aggregate, 4 can only resolve columns as the grouping columns, which is completely covered by 3.

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

Instance Constructors

  1. new ResolveReferencesInSort(catalogManager: CatalogManager)

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(s: Sort): LogicalPlan
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. val catalogManager: CatalogManager
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @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: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  15. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  18. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  19. def logDebug(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  20. def logDebug(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  21. def logError(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  22. def logError(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  23. def logInfo(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  24. def logInfo(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  25. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  26. def logTrace(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  27. def logTrace(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  28. def logWarning(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  29. def logWarning(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  30. def lookupVariable(nameParts: Seq[String]): Option[VariableReference]
    Definition Classes
    ColumnResolutionHelper
  31. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  32. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  33. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  34. def resolveColWithAgg(e: Expression, plan: LogicalPlan): Expression
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  35. def resolveColsLastResort(e: Expression): Expression

    The last resort to resolve columns.

    The last resort to resolve columns. Currently it does two things:

    • Try to resolve column names as outer references
    • Try to resolve column names as SQL variable
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  36. def resolveExprInAssignment(expr: Expression, hostPlan: LogicalPlan): Expression
    Definition Classes
    ColumnResolutionHelper
  37. def resolveExpressionByPlanChildren(e: Expression, q: LogicalPlan, includeLastResort: 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
  38. def resolveExpressionByPlanOutput(expr: Expression, plan: LogicalPlan, throws: Boolean = false, includeLastResort: 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
  39. 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
  40. def resolveLateralColumnAlias(selectList: Seq[Expression]): Seq[Expression]
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  41. def resolveOuterRef(e: Expression): Expression
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  42. def resolveVariables(e: Expression): Expression
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  43. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  44. def toString(): String
    Definition Classes
    AnyRef → Any
  45. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from ColumnResolutionHelper

Inherited from Logging

Inherited from SQLConfHelper

Inherited from AnyRef

Inherited from Any

Ungrouped