diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala index c1e7e1880b86a..deaa49bf423b1 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala @@ -403,7 +403,8 @@ object TypeCoercion { /** Given a plan, add an extra project on top to widen some columns' data types. */ private def widenTypes(plan: LogicalPlan, targetTypes: Seq[DataType]): LogicalPlan = { val casted = plan.output.zip(targetTypes).map { - case (e, dt) if e.dataType != dt => Alias(Cast(e, dt), e.name)() + case (e, dt) if e.dataType != dt => + Alias(Cast(e, dt, Some(SQLConf.get.sessionLocalTimeZone)), e.name)() case (e, _) => e } Project(casted, plan)