Packages

class Analyzer extends RuleExecutor[LogicalPlan] with CheckAnalysis with AliasHelper with SQLConfHelper with ColumnResolutionHelper

Provides a logical query plan analyzer, which translates UnresolvedAttributes and UnresolvedRelations into fully typed objects using information in a SessionCatalog.

Linear Supertypes
ColumnResolutionHelper, SQLConfHelper, AliasHelper, CheckAnalysis, PlanToString, QueryErrorsBase, DataTypeErrorsBase, LookupCatalog, RuleExecutor[LogicalPlan], Logging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Analyzer
  2. ColumnResolutionHelper
  3. SQLConfHelper
  4. AliasHelper
  5. CheckAnalysis
  6. PlanToString
  7. QueryErrorsBase
  8. DataTypeErrorsBase
  9. LookupCatalog
  10. RuleExecutor
  11. Logging
  12. AnyRef
  13. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Analyzer(catalog: SessionCatalog)
  2. new Analyzer(catalogManager: CatalogManager)

Type Members

  1. implicit class LogStringContext extends AnyRef
    Definition Classes
    Logging
  2. class ResolveReferences extends Rule[LogicalPlan] with ColumnResolutionHelper

    Resolves column references in the query plan.

    Resolves column references in the query plan. Basically it transform the query plan tree bottom up, and only try to resolve references for a plan node if all its children nodes are resolved, and there is no conflicting attributes between the children nodes (see hasConflictingAttrs for details).

    The general workflow to resolve references: 1. Expands the star in Project/Aggregate/Generate. 2. Resolves the columns to AttributeReference with the output of the children plans. This includes metadata columns as well. 3. Resolves the columns to literal function which is allowed to be invoked without braces, e.g. SELECT col, current_date FROM t. 4. Resolves the columns to outer references with the outer plan if we are resolving subquery expressions. 5. Resolves the columns to SQL variables.

    Some plan nodes have special column reference resolution logic, please read these sub-rules for details:

    Note: even if we use a single rule to resolve columns, it's still non-trivial to have a reliable column resolution order, as the rule will be executed multiple times, with other rules in the same batch. We should resolve columns with the next option only if all the previous options are permanently not applicable. If the current option can be applicable in the next iteration (other rules update the plan), we should not try the next option.

  3. case class Batch(name: String, strategy: Strategy, rules: Rule[TreeType]*) extends Product with Serializable

    A batch of rules.

    A batch of rules.

    Attributes
    protected[catalyst]
    Definition Classes
    RuleExecutor
  4. case class FixedPoint(maxIterations: Int, errorOnExceed: Boolean = false, maxIterationsSetting: String = null) extends Strategy with Product with Serializable

    A strategy that runs until fix point or maxIterations times, whichever comes first.

    A strategy that runs until fix point or maxIterations times, whichever comes first. Especially, a FixedPoint(1) batch is supposed to run only once.

    Definition Classes
    RuleExecutor
  5. abstract class Strategy extends AnyRef

    An execution strategy for rules that indicates the maximum number of executions.

    An execution strategy for rules that indicates the maximum number of executions. If the execution reaches fix point (i.e. converge) before maxIterations, it will stop.

    Definition Classes
    RuleExecutor

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. val DATA_TYPE_MISMATCH_ERROR: TreeNodeTag[Unit]
    Definition Classes
    CheckAnalysis
  5. val INVALID_FORMAT_ERROR: TreeNodeTag[Unit]
    Definition Classes
    CheckAnalysis
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def batches: Seq[Batch]

    Defines a sequence of rule batches, to be overridden by the implementation.

    Defines a sequence of rule batches, to be overridden by the implementation.

    Definition Classes
    AnalyzerRuleExecutor
  8. val catalogManager: CatalogManager
    Definition Classes
    AnalyzerColumnResolutionHelper → LookupCatalog
  9. def checkAnalysis(plan: LogicalPlan): Unit
    Definition Classes
    CheckAnalysis
  10. def checkAnalysis0(plan: LogicalPlan): Unit
    Definition Classes
    CheckAnalysis
  11. def checkSubqueryExpression(plan: LogicalPlan, expr: SubqueryExpression): Unit
    Definition Classes
    CheckAnalysis
  12. def checkTrailingCommaInSelect(plan: LogicalPlan, starRemoved: Boolean = false): Unit

    Checks for errors in a SELECT clause, such as a trailing comma or an empty select list.

    Checks for errors in a SELECT clause, such as a trailing comma or an empty select list.

    plan

    The logical plan of the query.

    starRemoved

    Whether a '*' (wildcard) was removed from the select list.

    Attributes
    protected
    Definition Classes
    CheckAnalysis
    Exceptions thrown

    AnalysisException if the select list is empty or ends with a trailing comma.

  13. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  14. 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
  15. def currentCatalog: CatalogPlugin

    Returns the current catalog set.

    Returns the current catalog set.

    Definition Classes
    LookupCatalog
  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  18. val excludedOnceBatches: Set[String]

    Once batches that are excluded in the idempotence checker

    Once batches that are excluded in the idempotence checker

    Attributes
    protected
    Definition Classes
    RuleExecutor
  19. def execute(plan: LogicalPlan): LogicalPlan

    Executes the batches of rules defined by the subclass.

    Executes the batches of rules defined by the subclass. The batches are executed serially using the defined execution strategy. Within each batch, rules are also executed serially.

    Definition Classes
    AnalyzerRuleExecutor
  20. def executeAndCheck(plan: LogicalPlan, tracker: QueryPlanningTracker): LogicalPlan
  21. def executeAndTrack(plan: LogicalPlan, tracker: QueryPlanningTracker): LogicalPlan

    Executes the batches of rules defined by the subclass, and also tracks timing info for each rule using the provided tracker.

    Executes the batches of rules defined by the subclass, and also tracks timing info for each rule using the provided tracker.

    Definition Classes
    RuleExecutor
    See also

    execute

  22. val extendedCheckRules: Seq[(LogicalPlan) => Unit]

    Override to provide additional checks for correct analysis.

    Override to provide additional checks for correct analysis. These rules will be evaluated after our built-in check rules.

    Definition Classes
    CheckAnalysis
  23. val extendedResolutionRules: Seq[Rule[LogicalPlan]]

    Override to provide additional rules for the "Resolution" batch.

  24. def failAnalysis(errorClass: String, messageParameters: Map[String, String]): Nothing

    Fails the analysis at the point where a specific tree node was parsed using a provided error class and message parameters.

    Fails the analysis at the point where a specific tree node was parsed using a provided error class and message parameters.

    Definition Classes
    CheckAnalysis
  25. def fixedPoint: FixedPoint

    If the plan cannot be resolved within maxIterations, analyzer will throw exception to inform user to increase the value of SQLConf.ANALYZER_MAX_ITERATIONS.

    If the plan cannot be resolved within maxIterations, analyzer will throw exception to inform user to increase the value of SQLConf.ANALYZER_MAX_ITERATIONS.

    Attributes
    protected
  26. def getAliasMap(exprs: Seq[NamedExpression]): AttributeMap[Alias]
    Attributes
    protected
    Definition Classes
    AliasHelper
  27. def getAliasMap(plan: Aggregate): AttributeMap[Alias]
    Attributes
    protected
    Definition Classes
    AliasHelper
  28. def getAliasMap(plan: Project): AttributeMap[Alias]
    Attributes
    protected
    Definition Classes
    AliasHelper
  29. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  30. def getQueryContext(context: QueryContext): Array[QueryContext]
    Definition Classes
    DataTypeErrorsBase
  31. def getSummary(sqlContext: QueryContext): String
    Definition Classes
    DataTypeErrorsBase
  32. def hasMapType(dt: DataType): Boolean
    Attributes
    protected
    Definition Classes
    CheckAnalysis
  33. def hasVariantType(dt: DataType): Boolean
    Attributes
    protected
    Definition Classes
    CheckAnalysis
  34. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  35. val hintResolutionRules: Seq[Rule[LogicalPlan]]

    Override to provide additional rules for the "Hints" resolution batch.

  36. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  37. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  38. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  39. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  40. def isView(nameParts: Seq[String]): Boolean
    Definition Classes
    AnalyzerCheckAnalysis
  41. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  42. def logDebug(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  43. def logDebug(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  44. def logDebug(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  45. def logDebug(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  46. def logError(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  47. def logError(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  48. def logError(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  49. def logError(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  50. def logInfo(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  51. def logInfo(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  52. def logInfo(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  53. def logInfo(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  54. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  55. def logTrace(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  56. def logTrace(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  57. def logTrace(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  58. def logTrace(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  59. def logWarning(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  60. def logWarning(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  61. def logWarning(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  62. def logWarning(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  63. def lookupVariable(nameParts: Seq[String]): Option[VariableReference]

    Look up variable by nameParts.

    Look up variable by nameParts. If in SQL Script, first check local variables, unless in EXECUTE IMMEDIATE (EXECUTE IMMEDIATE generated query cannot access local variables). if not found fall back to session variables.

    nameParts

    NameParts of the variable.

    returns

    Reference to the variable.

    Definition Classes
    ColumnResolutionHelper
  64. def mapColumnInSetOperation(plan: LogicalPlan): Option[Attribute]
    Attributes
    protected
    Definition Classes
    CheckAnalysis
  65. def name: String

    Name for this rule executor, automatically inferred based on class name.

    Name for this rule executor, automatically inferred based on class name.

    Attributes
    protected
    Definition Classes
    RuleExecutor
  66. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  67. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  68. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  69. def ordinalNumber(i: Int): String
    Definition Classes
    QueryErrorsBase
  70. def planToString(plan: LogicalPlan): String
    Attributes
    protected
    Definition Classes
    PlanToString
  71. val postHocResolutionRules: Seq[Rule[LogicalPlan]]

    Override to provide rules to do post-hoc resolution.

    Override to provide rules to do post-hoc resolution. Note that these rules will be executed in an individual batch. This batch is to run right after the normal resolution batch and execute its rules in one pass.

  72. val preemptedError: PreemptedError
    Definition Classes
    CheckAnalysis
  73. def quoteByDefault(elem: String): String
    Attributes
    protected
    Definition Classes
    DataTypeErrorsBase
  74. 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
  75. 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
  76. def resolveColWithAgg(e: Expression, plan: LogicalPlan): Expression
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  77. 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
  78. def resolveExprInAssignment(expr: Expression, hostPlan: LogicalPlan): Expression
    Definition Classes
    ColumnResolutionHelper
  79. 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
  80. 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
  81. 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
  82. def resolveLateralColumnAlias(selectList: Seq[Expression]): Seq[Expression]
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  83. def resolveOuterRef(e: Expression): Expression
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  84. def resolveVariables(e: Expression): Expression
    Attributes
    protected
    Definition Classes
    ColumnResolutionHelper
  85. def resolver: Resolver
  86. def scrubOutIds(string: String): String
    Attributes
    protected
    Definition Classes
    PlanToString
  87. val singlePassMetadataResolverExtensions: Seq[ResolverExtension]

    Extensions used for early resolution of the single-pass analyzer.

    Extensions used for early resolution of the single-pass analyzer.

    See ResolverExtension for more info.

  88. val singlePassResolverExtensions: Seq[ResolverExtension]

    Extensions for the single-pass analyzer.

    Extensions for the single-pass analyzer.

    See ResolverExtension for more info.

  89. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  90. def toDSOption(option: String): String
    Definition Classes
    DataTypeErrorsBase
  91. def toSQLConf(conf: String): String
    Definition Classes
    DataTypeErrorsBase
  92. def toSQLConfVal(conf: String): String
    Definition Classes
    QueryErrorsBase
  93. def toSQLExpr(e: Expression): String
    Definition Classes
    QueryErrorsBase
  94. def toSQLId(parts: Seq[String]): String
    Definition Classes
    DataTypeErrorsBase
  95. def toSQLId(parts: String): String
    Definition Classes
    DataTypeErrorsBase
  96. def toSQLStmt(text: String): String
    Definition Classes
    DataTypeErrorsBase
  97. def toSQLType(t: AbstractDataType): String
    Definition Classes
    DataTypeErrorsBase
  98. def toSQLType(text: String): String
    Definition Classes
    DataTypeErrorsBase
  99. def toSQLValue(v: Any, t: DataType): String
    Definition Classes
    QueryErrorsBase
  100. def toSQLValue(value: Double): String
    Definition Classes
    DataTypeErrorsBase
  101. def toSQLValue(value: Float): String
    Definition Classes
    DataTypeErrorsBase
  102. def toSQLValue(value: Long): String
    Definition Classes
    DataTypeErrorsBase
  103. def toSQLValue(value: Int): String
    Definition Classes
    DataTypeErrorsBase
  104. def toSQLValue(value: Short): String
    Definition Classes
    DataTypeErrorsBase
  105. def toSQLValue(value: UTF8String): String
    Definition Classes
    DataTypeErrorsBase
  106. def toSQLValue(value: String): String
    Definition Classes
    DataTypeErrorsBase
  107. def toString(): String
    Definition Classes
    AnyRef → Any
  108. def trimAliases(e: Expression): Expression
    Attributes
    protected
    Definition Classes
    AliasHelper
  109. def trimNonTopLevelAliases[T <: Expression](e: T): T
    Attributes
    protected
    Definition Classes
    AliasHelper
  110. def validatePlanChanges(previousPlan: LogicalPlan, currentPlan: LogicalPlan): Option[String]

    Defines a validate function that validates the plan changes after the execution of each rule, to make sure these rules make valid changes to the plan.

    Defines a validate function that validates the plan changes after the execution of each rule, to make sure these rules make valid changes to the plan. For example, we can check whether a plan is still resolved after each rule in Optimizer, so that we can catch rules that turn the plan into unresolved.

    Attributes
    protected
    Definition Classes
    AnalyzerRuleExecutor
  111. def validatePlanChangesLightweight(previousPlan: LogicalPlan, currentPlan: LogicalPlan): Option[String]

    Defines a validate function that validates the plan changes after the execution of each rule, to make sure these rules make valid changes to the plan.

    Defines a validate function that validates the plan changes after the execution of each rule, to make sure these rules make valid changes to the plan. Since this is enabled by default, this should only consist of very lightweight checks.

    Attributes
    protected
    Definition Classes
    RuleExecutor
  112. def variantColumnInSetOperation(plan: LogicalPlan): Option[Attribute]
    Attributes
    protected
    Definition Classes
    CheckAnalysis
  113. def variantExprInPartitionExpression(plan: LogicalPlan): Option[Expression]
    Attributes
    protected
    Definition Classes
    CheckAnalysis
  114. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  115. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  116. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  117. def withLogContext(context: Map[String, String])(body: => Unit): Unit
    Attributes
    protected
    Definition Classes
    Logging
  118. def withSQLConf[T](pairs: (String, String)*)(f: => T): T

    Sets all SQL configurations specified in pairs, calls f, and then restores all SQL configurations.

    Sets all SQL configurations specified in pairs, calls f, and then restores all SQL configurations.

    Attributes
    protected
    Definition Classes
    SQLConfHelper
  119. object AddMetadataColumns extends Rule[LogicalPlan]

    Adds metadata columns to output for child relations when nodes are missing resolved attributes.

    Adds metadata columns to output for child relations when nodes are missing resolved attributes.

    References to metadata columns are resolved using columns from LogicalPlan.metadataOutput, but the relation's output does not include the metadata columns until the relation is replaced. Unless this rule adds metadata to the relation's output, the analyzer will detect that nothing produces the columns.

    This rule only adds metadata columns when a node is resolved but is missing input from its children. This ensures that metadata columns are not added to the plan unless they are used. By checking only resolved nodes, this ensures that * expansion is already done so that metadata columns are not accidentally selected by *. This rule resolves operators downwards to avoid projecting away metadata columns prematurely.

  120. object AsTableIdentifier

    Extract legacy table identifier from a multi-part identifier.

    Extract legacy table identifier from a multi-part identifier.

    For legacy support only. Please use CatalogAndIdentifier instead on DSv2 code paths.

    Definition Classes
    LookupCatalog
  121. object BindProcedures extends Rule[LogicalPlan]

    A rule that binds procedures to the input types and rearranges arguments as needed.

  122. object CatalogAndIdentifier

    Extract catalog and identifier from a multi-part name with the current catalog if needed.

    Extract catalog and identifier from a multi-part name with the current catalog if needed. Catalog name takes precedence over identifier, but for a single-part name, identifier takes precedence over catalog name.

    Note that, this pattern is used to look up permanent catalog objects like table, view, function, etc. If you need to look up temp objects like temp view, please do it separately before calling this pattern, as temp objects don't belong to any catalog.

    Definition Classes
    LookupCatalog
  123. object CatalogAndNamespace

    Extract catalog and namespace from a multi-part name with the current catalog if needed.

    Extract catalog and namespace from a multi-part name with the current catalog if needed. Catalog name takes precedence over namespaces.

    Definition Classes
    LookupCatalog
  124. object ExtractGenerator extends Rule[LogicalPlan]

    Extracts Generator from the projectList of a Project operator and creates Generate operator under Project.

    Extracts Generator from the projectList of a Project operator and creates Generate operator under Project.

    This rule will throw AnalysisException for following cases: 1. Generator is nested in expressions, e.g. SELECT explode(list) + 1 FROM tbl 2. more than one Generator is found in projectList, e.g. SELECT explode(list), explode(list) FROM tbl 3. Generator is found in other operators that are not Project or Generate, e.g. SELECT * FROM tbl SORT BY explode(list)

  125. object ExtractWindowExpressions extends Rule[LogicalPlan]

    Extracts WindowExpressions from the projectList of a Project operator and aggregateExpressions of an Aggregate operator and creates individual Window operators for every distinct WindowSpecDefinition.

    Extracts WindowExpressions from the projectList of a Project operator and aggregateExpressions of an Aggregate operator and creates individual Window operators for every distinct WindowSpecDefinition.

    This rule handles three cases:

    • A Project having WindowExpressions in its projectList;
    • An Aggregate having WindowExpressions in its aggregateExpressions.
    • A Filter->Aggregate pattern representing GROUP BY with a HAVING clause and the Aggregate has WindowExpressions in its aggregateExpressions. Note: If there is a GROUP BY clause in the query, aggregations and corresponding filters (expressions in the HAVING clause) should be evaluated before any WindowExpression. If a query has SELECT DISTINCT, the DISTINCT part should be evaluated after all WindowExpressions.

    Note: ResolveLateralColumnAliasReference rule is applied before this rule. To guarantee this order, we make sure this rule applies only when the Project or Aggregate doesn't contain any LATERAL_COLUMN_ALIAS_REFERENCE.

    For every case, the transformation works as follows: 1. For a list of Expressions (a projectList or an aggregateExpressions), partitions it two lists of Expressions, one for all WindowExpressions and another for all regular expressions. 2. For all WindowExpressions, groups them based on their WindowSpecDefinitions and WindowFunctionTypes. 3. For every distinct WindowSpecDefinition and WindowFunctionType, creates a Window operator and inserts it into the plan tree.

  126. object GlobalAggregates extends Rule[LogicalPlan]

    Turns projections that contain aggregate expressions into aggregations.

  127. object HandleNullInputsForUDF extends Rule[LogicalPlan]

    Correctly handle null primitive inputs for UDF by adding extra If expression to do the null check.

    Correctly handle null primitive inputs for UDF by adding extra If expression to do the null check. When user defines a UDF with primitive parameters, there is no way to tell if the primitive parameter is null or not, so here we assume the primitive input is null-propagatable and we should return null if the input is null.

  128. object HandleSpecialCommand extends Rule[LogicalPlan]

    A rule to handle special commands that need to be notified when analysis is done.

    A rule to handle special commands that need to be notified when analysis is done. This rule should run after all other analysis rules are run.

  129. object LookupFunctions extends Rule[LogicalPlan]

    Checks whether a function identifier referenced by an UnresolvedFunction is defined in the function registry.

    Checks whether a function identifier referenced by an UnresolvedFunction is defined in the function registry. Note that this rule doesn't try to resolve the UnresolvedFunction. It only performs simple existence check according to the function identifier to quickly identify undefined functions without triggering relation resolution, which may incur potentially expensive partition/schema discovery process in some cases. In order to avoid duplicate external functions lookup, the external function identifier will store in the local hash set externalFunctionNameSet.

    See also

    ResolveFunctions

    https://issues.apache.org/jira/browse/SPARK-19737

  130. object NonSessionCatalogAndIdentifier

    Extract non-session catalog and identifier from a multi-part identifier.

    Extract non-session catalog and identifier from a multi-part identifier.

    Definition Classes
    LookupCatalog
  131. object ResolveAggregateFunctions extends Rule[LogicalPlan]

    This rule finds aggregate expressions that are not in an aggregate operator.

    This rule finds aggregate expressions that are not in an aggregate operator. For example, those in a HAVING clause or ORDER BY clause. These expressions are pushed down to the underlying aggregate operator and then projected away after the original operator.

    We need to make sure the expressions all fully resolved before looking for aggregate functions and group by expressions from them.

  132. object ResolveAliases extends Rule[LogicalPlan]

    Replaces UnresolvedAliass with concrete aliases.

  133. object ResolveBinaryArithmetic extends Rule[LogicalPlan]

    For Add: 1.

    For Add: 1. if both side are interval, stays the same; 2. else if one side is date and the other is interval, turns it to DateAddInterval; 3. else if one side is interval, turns it to TimeAdd; 4. else if one side is date, turns it to DateAdd ; 5. else stays the same.

    For Subtract: 1. if both side are interval, stays the same; 2. else if the left side is date and the right side is interval, turns it to -r); 3. else if the right side is an interval, turns it to -r); 4. else if one side is timestamp, turns it to SubtractTimestamps; 5. else if the right side is date, turns it to DateDiff/SubtractDates; 6. else if the left side is date, turns it to DateSub; 7. else turns it to stays the same.

    For Multiply: 1. If one side is interval, turns it to MultiplyInterval; 2. otherwise, stays the same.

    For Divide: 1. If the left side is interval, turns it to DivideInterval; 2. otherwise, stays the same.

  134. object ResolveDeserializer extends Rule[LogicalPlan]

    Replaces UnresolvedDeserializer with the deserialization expression that has been resolved to the given input attributes.

  135. object ResolveEncodersInUDF extends Rule[LogicalPlan]

    Resolve the encoders for the UDF by explicitly given the attributes.

    Resolve the encoders for the UDF by explicitly given the attributes. We give the attributes explicitly in order to handle the case where the data type of the input value is not the same with the internal schema of the encoder, which could cause data loss. For example, the encoder should not cast the input value to Decimal(38, 18) if the actual data type is Decimal(30, 0).

    The resolved encoders then will be used to deserialize the internal row to Scala value.

  136. object ResolveFieldNameAndPosition extends Rule[LogicalPlan]

    Rule to resolve, normalize and rewrite field names based on case sensitivity for commands.

  137. object ResolveFunctions extends Rule[LogicalPlan]

    Replaces UnresolvedFunctionNames with concrete LogicalPlans.

    Replaces UnresolvedFunctionNames with concrete LogicalPlans. Replaces UnresolvedFunctions with concrete Expressions. Replaces UnresolvedGenerators with concrete Expressions. Replaces UnresolvedTableValuedFunctions with concrete LogicalPlans.

  138. object ResolveGenerate extends Rule[LogicalPlan]

    Rewrites table generating expressions that either need one or more of the following in order to be resolved:

    Rewrites table generating expressions that either need one or more of the following in order to be resolved:

    • concrete attribute references for their output.
    • to be relocated from a SELECT clause (i.e. from a Project) into a Generate).

    Names for the output Attributes are extracted from Alias or MultiAlias expressions that wrap the Generator.

  139. object ResolveGroupingAnalytics extends Rule[LogicalPlan]
  140. object ResolveInsertInto extends ResolveInsertionBase

    Handle INSERT INTO for DSv2

  141. object ResolveNaturalAndUsingJoin extends Rule[LogicalPlan]

    Removes natural or using joins by calculating output columns based on output from two sides, Then apply a Project on a normal Join to eliminate natural or using join.

  142. object ResolveNewInstance extends Rule[LogicalPlan]

    Resolves NewInstance by finding and adding the outer scope to it if the object being constructed is an inner class.

  143. object ResolveOrdinalInOrderByAndGroupBy extends Rule[LogicalPlan]

    In many dialects of SQL it is valid to use ordinal positions in order/sort by and group by clauses.

    In many dialects of SQL it is valid to use ordinal positions in order/sort by and group by clauses. This rule is to convert ordinal positions to the corresponding expressions in the select list. This support is introduced in Spark 2.0.

    - When the sort references or group by expressions are not integer but foldable expressions, just ignore them. - When spark.sql.orderByOrdinal/spark.sql.groupByOrdinal is set to false, ignore the position numbers too.

    Before the release of Spark 2.0, the literals in order/sort by and group by clauses have no effect on the results.

  144. object ResolveOutputRelation extends Rule[LogicalPlan]

    Resolves columns of an output table from the data in a logical plan.

    Resolves columns of an output table from the data in a logical plan. This rule will:

    - Reorder columns when the write is by name - Insert casts when data types do not match - Insert aliases when column names do not match - Detect plans that are not compatible with the output table and throw AnalysisException

  145. object ResolvePivot extends Rule[LogicalPlan]
  146. object ResolveProcedures extends Rule[LogicalPlan]

    A rule that resolves procedures.

  147. object ResolveRandomSeed extends Rule[LogicalPlan]

    Set the seed for random number generation.

  148. object ResolveRelations extends Rule[LogicalPlan]

    Replaces unresolved relations (tables and views) with concrete relations from the catalog.

  149. object ResolveSQLFunctions extends Rule[LogicalPlan]

    This rule resolves SQL function expressions.

    This rule resolves SQL function expressions. It pulls out function inputs and place them in a separate Project node below the operator and replace the SQL function with its actual function body. SQL function expressions in Aggregate are handled in a special way. Non-aggregated SQL functions in the aggregate expressions of an Aggregate need to be pulled out into a Project above the Aggregate before replacing the SQL function expressions with actual function bodies. For example:

    Before: Aggregate [c1] [foo(c1), foo(max(c2)), sum(foo(c2)) AS sum] +- Relation [c1, c2]

    After: Project [foo(c1), foo(max_c2), sum] +- Aggregate [c1] [c1, max(c2) AS max_c2, sum(foo(c2)) AS sum] +- Relation [c1, c2]

  150. object ResolveSQLTableFunctions extends Rule[LogicalPlan] with AliasHelper
  151. object ResolveSubquery extends Rule[LogicalPlan]

    This rule resolves and rewrites subqueries inside expressions.

    This rule resolves and rewrites subqueries inside expressions.

    Note: CTEs are handled in CTESubstitution.

  152. object ResolveSubqueryColumnAliases extends Rule[LogicalPlan]

    Replaces unresolved column aliases for a subquery with projections.

  153. object ResolveUnpivot extends Rule[LogicalPlan]
  154. object ResolveUpCast extends Rule[LogicalPlan]

    Replace the UpCast expression by Cast, and throw exceptions if the cast may truncate.

  155. object ResolveWindowFrame extends Rule[LogicalPlan]

    Check and add proper window frames for all window functions.

  156. object ResolveWindowOrder extends Rule[LogicalPlan]

    Check and add order to AggregateWindowFunctions.

  157. object SessionCatalogAndIdentifier

    Extract session catalog and identifier from a multi-part identifier.

    Extract session catalog and identifier from a multi-part identifier.

    Definition Classes
    LookupCatalog
  158. object WindowsSubstitution extends Rule[LogicalPlan]

    Substitute child plan with WindowSpecDefinitions.

  159. case object Once extends Strategy with Product with Serializable

    A strategy that is run once and idempotent.

    A strategy that is run once and idempotent.

    Definition Classes
    RuleExecutor

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 ColumnResolutionHelper

Inherited from SQLConfHelper

Inherited from AliasHelper

Inherited from CheckAnalysis

Inherited from PlanToString

Inherited from QueryErrorsBase

Inherited from DataTypeErrorsBase

Inherited from LookupCatalog

Inherited from RuleExecutor[LogicalPlan]

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped