Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/16777#discussion_r100898554 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala --- @@ -117,49 +115,67 @@ object TypeCoercion { * loss of precision when widening decimal and double, and promotion to string. */ private[analysis] def findWiderTypeForTwo(t1: DataType, t2: DataType): Option[DataType] = { - (t1, t2) match { - case (t1: DecimalType, t2: DecimalType) => - Some(DecimalPrecision.widerDecimalType(t1, t2)) - case (t: IntegralType, d: DecimalType) => - Some(DecimalPrecision.widerDecimalType(DecimalType.forType(t), d)) - case (d: DecimalType, t: IntegralType) => - Some(DecimalPrecision.widerDecimalType(DecimalType.forType(t), d)) - case (_: FractionalType, _: DecimalType) | (_: DecimalType, _: FractionalType) => - Some(DoubleType) - case _ => - findTightestCommonTypeToString(t1, t2) - } + findTightestCommonType(t1, t2) + .orElse(findWiderTypeForDecimal(t1, t2)) --- End diff -- Yes. Integer will be promoted to a wider Decimal anyway.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org