Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maropu committed Dec 29, 2017
1 parent 57a9d1e commit b9febbd
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -659,12 +659,14 @@ object CombineConcats extends Rule[LogicalPlan] {
Concat(flattened)
}

private def hasNestedConcats(concat: Concat): Boolean = concat.children.exists {
case c: Concat => true
case c @ Cast(Concat(children), StringType, _) => true
case _ => false
}

def apply(plan: LogicalPlan): LogicalPlan = plan.transformExpressionsDown {
case concat: Concat if concat.children.exists {
case c: Concat => true
case c @ Cast(Concat(children), StringType, _) => true
case _ => false
} =>
case concat: Concat if hasNestedConcats(concat) =>
flattenConcats(concat)
}
}

0 comments on commit b9febbd

Please sign in to comment.