Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/10577#discussion_r48897156 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala --- @@ -212,22 +212,47 @@ object HiveTypeCoercion { case other => None } - def castOutput(plan: LogicalPlan): LogicalPlan = { - val casted = plan.output.zip(castedTypes).map { - case (e, Some(dt)) if e.dataType != dt => - Alias(Cast(e, dt), e.name)() - case (e, _) => e - } - Project(casted, plan) + if (castedTypes.exists(_.isDefined)) { + (castOutput(left, castedTypes), castOutput(right, castedTypes)) + } else { + (left, right) } + } + + private[this] def widenOutputTypes( + planName: String, + children: Seq[LogicalPlan]): Seq[LogicalPlan] = { + require(children.forall(_.output.length == children.head.output.length)) + + val castedTypes: Seq[Option[DataType]] = + children.tail.foldLeft(children.head.output.map(a => Option(a.dataType))) { --- End diff -- There is a bug in this function. Will fix it tonight. Thanks!
--- 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