Skip to content

Commit 932ea01

Browse files
committed
fix add columnar to row
1 parent 06b8a53 commit 932ea01

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

spark/src/main/scala/org/apache/comet/rules/CometExecRule.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -609,17 +609,19 @@ case class CometExecRule(session: SparkSession) extends Rule[SparkPlan] {
609609
}
610610

611611
plan.transformUp { case op =>
612-
val newOp = convertNode(op)
613-
// if newOp is not columnar and newOp.children has columnar, we need to add columnar to row
614-
if (!newOp.supportsColumnar && !newOp.isInstanceOf[ColumnarToRowTransition]) {
615-
val newChildren = newOp.children.map {
612+
convertNode(op)
613+
}
614+
615+
// insert CometColumnarToRowExec if necessary
616+
plan.transformUp {
617+
case c2r: ColumnarToRowTransition => c2r
618+
case op if !op.supportsColumnar =>
619+
val newChildren = op.children.map {
616620
case c if c.supportsColumnar => CometColumnarToRowExec(c)
617621
case other => other
618622
}
619-
newOp.withNewChildren(newChildren)
620-
} else {
621-
newOp
622-
}
623+
op.withNewChildren(newChildren)
624+
case o => o
623625
}
624626
}
625627

0 commit comments

Comments
 (0)