diff --git a/spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala b/spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala index 1c0f7bbf7..cd0b830b2 100644 --- a/spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala +++ b/spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala @@ -295,6 +295,7 @@ class CometSparkSessionExtensions case Some(nativeOp) => val cometOp = CometUnionExec(u, u.children) CometSinkPlaceHolder(nativeOp, u, cometOp) + case None => u } case op => diff --git a/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala b/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala index 609026ee0..e52018b38 100644 --- a/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala +++ b/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala @@ -1698,6 +1698,10 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde { if (scanTypes.length == op.output.length) { scanBuilder.addAllFields(scanTypes.asJava) + + // Sink operators don't have children + result.clearChildren() + Some(result.setScan(scanBuilder).build()) } else { // There are unsupported scan type