Packages

class BinaryArithmeticResolver extends TreeNodeResolver[BinaryArithmetic, Expression] with ProducesUnresolvedSubtree

BinaryArithmeticResolver is invoked by ExpressionResolver in order to resolve BinaryArithmetic nodes. During resolution, calling BinaryArithmeticWithDatetimeResolver and applying type coercion can result in BinaryArithmetic producing some other type of node or a subtree of nodes. In such cases a downwards traversal is necessary, but not going deeper than the original expression's children, since all nodes below that point are guaranteed to be already resolved.

For example, given a query:

SELECT '4 11:11' - INTERVAL '4 22:12' DAY TO MINUTE

BinaryArithmeticResolver is called for the following expression:

Subtract( Literal('4 11:11', StringType), Literal(Interval('4 22:12' DAY TO MINUTE), DayTimeIntervalType(0,2)) )

After calling BinaryArithmeticWithDatetimeResolver and applying type coercion, the expression is transformed into:

Cast( DatetimeSub( TimeAdd( Literal('4 11:11', StringType), UnaryMinus( Literal(Interval('4 22:12' DAY TO MINUTE), DayTimeIntervalType(0,2)) ) ) ) )

A single Subtract node is replaced with a subtree of nodes. In order to resolve this subtree we need to invoke ExpressionResolver recursively on the top-most node's children. The top-most node itself is not resolved recursively in order to avoid recursive calls to BinaryArithmeticResolver and other sub-resolvers. To prevent a case where we resolve the same node twice, we need to mark nodes that will act as a limit for the downwards traversal by applying a ExpressionResolver.SINGLE_PASS_SUBTREE_BOUNDARY tag to them. These children along with all the nodes below them are guaranteed to be resolved at this point. When ExpressionResolver reaches one of the tagged nodes, it returns identity rather than resolving it. Finally, after resolving the subtree, we need to resolve the top-most node itself, which in this case means applying a timezone, if necessary.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BinaryArithmeticResolver
  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 BinaryArithmeticResolver(expressionResolver: ExpressionResolver, timezoneAwareExpressionResolver: TimezoneAwareExpressionResolver)

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 getQueryContext(context: QueryContext): Array[QueryContext]
    Definition Classes
    DataTypeErrorsBase
  11. def getSummary(sqlContext: QueryContext): String
    Definition Classes
    DataTypeErrorsBase
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  17. def ordinalNumber(i: Int): String
    Definition Classes
    QueryErrorsBase
  18. def quoteByDefault(elem: String): String
    Attributes
    protected
    Definition Classes
    DataTypeErrorsBase
  19. def resolve(unresolvedBinaryArithmetic: BinaryArithmetic): Expression
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toDSOption(option: String): String
    Definition Classes
    DataTypeErrorsBase
  22. def toSQLConf(conf: String): String
    Definition Classes
    DataTypeErrorsBase
  23. def toSQLConfVal(conf: String): String
    Definition Classes
    QueryErrorsBase
  24. def toSQLExpr(e: Expression): String
    Definition Classes
    QueryErrorsBase
  25. def toSQLId(parts: Seq[String]): String
    Definition Classes
    DataTypeErrorsBase
  26. def toSQLId(parts: String): String
    Definition Classes
    DataTypeErrorsBase
  27. def toSQLStmt(text: String): String
    Definition Classes
    DataTypeErrorsBase
  28. def toSQLType(t: AbstractDataType): String
    Definition Classes
    DataTypeErrorsBase
  29. def toSQLType(text: String): String
    Definition Classes
    DataTypeErrorsBase
  30. def toSQLValue(v: Any, t: DataType): String
    Definition Classes
    QueryErrorsBase
  31. def toSQLValue(value: Double): String
    Definition Classes
    DataTypeErrorsBase
  32. def toSQLValue(value: Float): String
    Definition Classes
    DataTypeErrorsBase
  33. def toSQLValue(value: Long): String
    Definition Classes
    DataTypeErrorsBase
  34. def toSQLValue(value: Int): String
    Definition Classes
    DataTypeErrorsBase
  35. def toSQLValue(value: Short): String
    Definition Classes
    DataTypeErrorsBase
  36. def toSQLValue(value: UTF8String): String
    Definition Classes
    DataTypeErrorsBase
  37. def toSQLValue(value: String): String
    Definition Classes
    DataTypeErrorsBase
  38. def toString(): String
    Definition Classes
    AnyRef → Any
  39. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  40. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  41. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  42. 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
  43. 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
  44. 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