cloud-fan commented on a change in pull request #25264:
[SPARK-28213][SQL][followup] code cleanup and bug fix for columnar execution
framework
URL: https://github.com/apache/spark/pull/25264#discussion_r309956991
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/WholeStageCodegenExec.scala
##########
@@ -522,13 +517,10 @@ case class InputAdapter(child: SparkPlan,
isChildColumnar: Boolean)
child.executeColumnar()
}
- override def inputRDD: RDD[InternalRow] = {
- if (isChildColumnar) {
- child.executeColumnar().asInstanceOf[RDD[InternalRow]] // Hack because
of type erasure
- } else {
- child.execute()
- }
- }
+ // `InputAdapter` can only generate code to process the rows from its child.
If the child produces
+ // columnar batches, there must be a `ColumnarToRowExec` above
`InputAdapter` to handle it by
+ // overriding `inputRDD`.
Review comment:
I tried the idea of `replace the InputAdapter with ColumnarToRowExec`
before. But then it's a little weird to see `ColumnarToRowExec` act as both the
boundary of columnar execution stage and codegen stage. We need to
1. handle `ColumnarToRowExec` specially when planning whole-stage-codegen
2. implement `ColumnarToRowExec.treeString`, which should print this
columnar node and remove the whole-stage-codegen mark from its child's
treeString
I feel it's simpler to always let `InputAdapter` be the boundary of codegen
stage.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]