org.apache.spark.sql.catalyst.analysis

TypeCoercion

object TypeCoercion

A collection of Rule that can be used to coerce differing types that participate in operations into compatible ones.

Notes about type widening / tightest common types: Broadly, there are two cases when we need to widen data types (e.g. union, binary comparison). In case 1, we are looking for a common data type for two or more data types, and in this case no loss of precision is allowed. Examples include type inference in JSON (e.g. what's the column's data type if one row is an integer while the other row is a long?). In case 2, we are looking for a widened data type with some acceptable loss of precision (e.g. there is no common type for double and decimal because double's range is larger than decimal, and yet decimal is more precise than double, but in union we would cast the decimal into double).

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TypeCoercion
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. object BooleanEquality extends Rule[LogicalPlan]

    Changes numeric values to booleans so that expressions like true = 1 can be evaluated.

  7. object CaseWhenCoercion extends Rule[LogicalPlan]

    Coerces the type of different branches of a CASE WHEN statement to a common type.

  8. object DateTimeOperations extends Rule[LogicalPlan]

    Turns Add/Subtract of DateType/TimestampType/StringType and CalendarIntervalType to TimeAdd/TimeSub

  9. object Division extends Rule[LogicalPlan]

    Hive only performs integral division with the DIV operator.

  10. object FunctionArgumentConversion extends Rule[LogicalPlan]

    This ensure that the types for various functions are as expected.

  11. object IfCoercion extends Rule[LogicalPlan]

    Coerces the type of different branches of If statement to a common type.

  12. object ImplicitTypeCasts extends Rule[LogicalPlan]

    Casts types according to the expected input types for Expressions.

  13. object InConversion extends Rule[LogicalPlan]

    Convert the value and in list expressions to the common operator type by looking at all the argument types and finding the closest one that all the arguments can be cast to.

  14. object PromoteStrings extends Rule[LogicalPlan]

    Promotes strings that appear in arithmetic expressions.

  15. object PropagateTypes extends Rule[LogicalPlan]

    Applies any changes to AttributeReference data types that are made by other rules to instances higher in the query tree.

  16. object StringToIntegralCasts extends Rule[LogicalPlan]

    When encountering a cast from a string representing a valid fractional number to an integral type the jvm will throw a java.lang.NumberFormatException.

  17. object WidenSetOperationTypes extends Rule[LogicalPlan]

    Widens numeric types and converts strings to numbers when appropriate.

  18. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  19. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  21. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  22. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. val findTightestCommonTypeOfTwo: (DataType, DataType) ⇒ Option[DataType]

    Case 1 type widening (see the classdoc comment above for TypeCoercion).

    Case 1 type widening (see the classdoc comment above for TypeCoercion).

    Find the tightest common type of two types that might be used in a binary expression. This handles all numeric types except fixed-precision decimals interacting with each other or with primitive types, because in that case the precision and scale of the result depends on the operation. Those rules are implemented in DecimalPrecision.

  24. def findTightestCommonTypeToString(left: DataType, right: DataType): Option[DataType]

    Similar to findTightestCommonType, but can promote all the way to StringType.

  25. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  26. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  27. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  28. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  29. final def notify(): Unit

    Definition Classes
    AnyRef
  30. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  31. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  32. def toString(): String

    Definition Classes
    AnyRef → Any
  33. val typeCoercionRules: List[Rule[LogicalPlan]]

  34. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped