Skip to content

Commit 851c223

Browse files
committed
fix add columnar to row
1 parent 06b8a53 commit 851c223

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -608,18 +608,20 @@ case class CometExecRule(session: SparkSession) extends Rule[SparkPlan] {
608608
}
609609
}
610610

611-
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 {
611+
val newPlan = plan.transformUp { case op =>
612+
convertNode(op)
613+
}
614+
615+
// insert CometColumnarToRowExec if necessary
616+
newPlan.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)