Packages

class ExpressionResolver extends TreeNodeResolver[Expression, Expression] with ProducesUnresolvedSubtree with ResolvesExpressionChildren

The ExpressionResolver is used by the Resolver during the analysis to resolve expressions.

The functions here generally traverse unresolved Expression nodes recursively, constructing and returning the resolved Expression nodes bottom-up. This is the primary entry point for implementing expression analysis, wherein the resolve method accepts a fully unresolved Expression and returns a fully resolved Expression in response with all data types and attribute reference ID assigned for valid requests. This resolver also takes responsibility to detect any errors in the initial SQL query or DataFrame and return appropriate error messages including precise parse locations wherever possible.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ExpressionResolver
  2. ProducesUnresolvedSubtree
  3. ResolvesExpressionChildren
  4. TreeNodeResolver
  5. QueryErrorsBase
  6. DataTypeErrorsBase
  7. SQLConfHelper
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ExpressionResolver(resolver: Resolver, functionResolution: FunctionResolution, planLogger: PlanLogger)

    resolver

    Resolver is passed from the parent to resolve other operators which are nested in expressions.

    functionResolution

    FunctionResolution to resolve function expressions.

    planLogger

    PlanLogger to log expression tree resolution events.

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  6. 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
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  10. def getExpressionIdAssigner: ExpressionIdAssigner
  11. def getExpressionResolutionContextStack: ArrayDeque[ExpressionResolutionContext]

    Get the expression resolution context stack.

  12. def getNameScopes: NameScopeStack

    Get NameScopeStack bound to the used Resolver.

  13. def getParentOperator: Option[LogicalPlan]

    Get the most recent operator (bottommost) from the parentOperators stack.

  14. def getQueryContext(context: QueryContext): Array[QueryContext]
    Definition Classes
    DataTypeErrorsBase
  15. def getSummary(sqlContext: QueryContext): String
    Definition Classes
    DataTypeErrorsBase
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  21. def ordinalNumber(i: Int): String
    Definition Classes
    QueryErrorsBase
  22. def quoteByDefault(elem: String): String
    Attributes
    protected
    Definition Classes
    DataTypeErrorsBase
  23. def resolve(unresolvedExpression: Expression): Expression

    This method is an expression analysis entry point.

    This method is an expression analysis entry point. The method first checks if the expression has already been resolved (necessary because of partially-unresolved subtrees, see ProducesUnresolvedSubtree). If not already resolved, method takes an unresolved Expression and chooses the right resolve* method using pattern matching on the unresolvedExpression type. This pattern matching enumerates all the expression node types that are supported by the single-pass analysis. When developers introduce a new Expression type to the Catalyst, they should implement a corresponding resolve* method in the ExpressionResolver and add it to this pattern match list.

    resolve will be called recursively during the expression tree traversal eventually producing a fully resolved expression subtree or a descriptive error message.

    resolve can recursively call resolver to resolve nested operators (e.g. scalar subqueries):

    SELECT * FROM VALUES (1), (2) WHERE col1 IN (SELECT 1);

    In this case IN is an expression and SELECT 1 is a nested operator tree for which the ExpressionResolver would invoke the Resolver.

    Definition Classes
    ExpressionResolverTreeNodeResolver
  24. def resolveExpressionGenericallyWithTypeCoercion(expression: Expression): Expression

    Resolves Expression by resolving its children and applying generic type coercion transformations to the resulting expression.

    Resolves Expression by resolving its children and applying generic type coercion transformations to the resulting expression. This resolution method is used for nodes that require type coercion on top of resolveExpressionGenerically.

  25. def resolveExpressionTreeInOperator(unresolvedExpression: Expression, parentOperator: LogicalPlan): Expression

    Resolve unresolvedExpression which is a child of parentOperator.

    Resolve unresolvedExpression which is a child of parentOperator. This is the main entry point into the ExpressionResolver for operators.

  26. def resolveLimitExpression(unresolvedLimitExpr: Expression, unresolvedLimit: LogicalPlan): Expression

    Resolve the limit expression from either a LocalLimit or a GlobalLimit operator.

  27. def resolveProjectList(unresolvedProjectList: Seq[NamedExpression], operator: LogicalPlan): ResolvedProjectList

    The Project list can contain different unresolved expressions before the resolution, which will be resolved using generic resolve.

    The Project list can contain different unresolved expressions before the resolution, which will be resolved using generic resolve. However, UnresolvedStar is a special case, because it is expanded into a sequence of NamedExpressions. Because of that this method returns a sequence and doesn't conform to generic resolve interface - it's called directly from the Resolver during Project resolution.

    The output sequence can be larger than the input sequence due to UnresolvedStar expansion.

    returns

    The list of resolved expressions along with flags indicating whether the resolved project list contains aggregate expressions or attributes (encapsulated in ResolvedProjectList) which are used during the further resolution of the tree. The following query:

    SELECT COUNT(col1), 2 FROM VALUES(1);

    would have a project list with two expressions: COUNT(col1) and 2. After the resolution it would return the following result: ResolvedProjectList( expressions = [count(col1) as count(col1), 2 AS 2], hasAggregateExpressions = true, // because it contains count(col1) in the project list hasAttributes = false // because it doesn't contain any AttributeReferences in the // project list (only under the aggregate expression, please check // AggregateExpressionResolver for more details).

  28. def resolveStar(unresolvedStar: UnresolvedStar): Seq[NamedExpression]

    UnresolvedStar resolution relies on the NameScope's ability to get the attributes by a multipart name (UnresolvedStar's target field):

    UnresolvedStar resolution relies on the NameScope's ability to get the attributes by a multipart name (UnresolvedStar's target field):

    - Star target is defined:

    SELECT t.* FROM VALUES (1) AS t;
    ->
    Project [col1#19]

    - Star target is not defined:

    SELECT * FROM (SELECT 1 as col1), (SELECT 2 as col2);
    ->
    Project [col1#19, col2#20]
  29. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  30. def toDSOption(option: String): String
    Definition Classes
    DataTypeErrorsBase
  31. def toSQLConf(conf: String): String
    Definition Classes
    DataTypeErrorsBase
  32. def toSQLConfVal(conf: String): String
    Definition Classes
    QueryErrorsBase
  33. def toSQLExpr(e: Expression): String
    Definition Classes
    QueryErrorsBase
  34. def toSQLId(parts: Seq[String]): String
    Definition Classes
    DataTypeErrorsBase
  35. def toSQLId(parts: String): String
    Definition Classes
    DataTypeErrorsBase
  36. def toSQLStmt(text: String): String
    Definition Classes
    DataTypeErrorsBase
  37. def toSQLType(t: AbstractDataType): String
    Definition Classes
    DataTypeErrorsBase
  38. def toSQLType(text: String): String
    Definition Classes
    DataTypeErrorsBase
  39. def toSQLValue(v: Any, t: DataType): String
    Definition Classes
    QueryErrorsBase
  40. def toSQLValue(value: Double): String
    Definition Classes
    DataTypeErrorsBase
  41. def toSQLValue(value: Float): String
    Definition Classes
    DataTypeErrorsBase
  42. def toSQLValue(value: Long): String
    Definition Classes
    DataTypeErrorsBase
  43. def toSQLValue(value: Int): String
    Definition Classes
    DataTypeErrorsBase
  44. def toSQLValue(value: Short): String
    Definition Classes
    DataTypeErrorsBase
  45. def toSQLValue(value: UTF8String): String
    Definition Classes
    DataTypeErrorsBase
  46. def toSQLValue(value: String): String
    Definition Classes
    DataTypeErrorsBase
  47. def toString(): String
    Definition Classes
    AnyRef → Any
  48. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  49. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  50. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  51. def withResolvedChildren[ExpressionType <: Expression](unresolvedExpression: ExpressionType, resolveChild: (Expression) => Expression): ExpressionType

    Resolves generic Expression children and returns its copy with children resolved.

    Resolves generic Expression children and returns its copy with children resolved.

    Attributes
    protected
    Definition Classes
    ResolvesExpressionChildren
  52. def withResolvedSubtree(expression: Expression, expressionResolver: (Expression) => Expression)(body: => Expression): Expression

    Helper method used to resolve a subtree that is generated as part of the resolution of some node.

    Helper method used to resolve a subtree that is generated as part of the resolution of some node. Method ensures that the downwards traversal never visits previously resolved nodes by tracking the limits of the traversal with a tag. Invokes a resolver callback to resolve children, but DOES NOT resolve the root of the subtree.

    Attributes
    protected
    Definition Classes
    ProducesUnresolvedSubtree
  53. 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

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 QueryErrorsBase

Inherited from DataTypeErrorsBase

Inherited from SQLConfHelper

Inherited from AnyRef

Inherited from Any

Ungrouped