Skip to content

Commit b9febbd

Browse files
committed
Fix
1 parent 57a9d1e commit b9febbd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -659,12 +659,14 @@ object CombineConcats extends Rule[LogicalPlan] {
659659
Concat(flattened)
660660
}
661661

662+
private def hasNestedConcats(concat: Concat): Boolean = concat.children.exists {
663+
case c: Concat => true
664+
case c @ Cast(Concat(children), StringType, _) => true
665+
case _ => false
666+
}
667+
662668
def apply(plan: LogicalPlan): LogicalPlan = plan.transformExpressionsDown {
663-
case concat: Concat if concat.children.exists {
664-
case c: Concat => true
665-
case c @ Cast(Concat(children), StringType, _) => true
666-
case _ => false
667-
} =>
669+
case concat: Concat if hasNestedConcats(concat) =>
668670
flattenConcats(concat)
669671
}
670672
}

0 commit comments

Comments
 (0)