Skip to content

Commit 1c94418

Browse files
committed
Fix
1 parent 179c6fd commit 1c94418

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -668,21 +668,17 @@ object TypeCoercion {
668668
*/
669669
case class ConcatCoercion(conf: SQLConf) extends TypeCoercionRule {
670670

671-
private def typeCastToString(c: Concat): Concat = {
672-
val newChildren = c.children.map { e =>
673-
ImplicitTypeCasts.implicitCast(e, StringType).getOrElse(e)
674-
}
675-
c.copy(children = newChildren)
676-
}
677-
678671
override protected def coerceTypes(plan: LogicalPlan): LogicalPlan = plan transform { case p =>
679672
p transformExpressionsUp {
680673
// Skip nodes if unresolved or empty children
681674
case c @ Concat(children) if !c.childrenResolved || children.isEmpty => c
682675

683676
case c @ Concat(children) if conf.concatBinaryAsString ||
684677
!children.map(_.dataType).forall(_ == BinaryType) =>
685-
typeCastToString(c)
678+
val newChildren = c.children.map { e =>
679+
ImplicitTypeCasts.implicitCast(e, StringType).getOrElse(e)
680+
}
681+
c.copy(children = newChildren)
686682
}
687683
}
688684
}

0 commit comments

Comments
 (0)