viirya commented on code in PR #60468:
URL: https://github.com/apache/spark/pull/60468#discussion_r4569620823
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/WholeStageCodegenSuite.scala:
##########
@@ -381,6 +383,57 @@ class WholeStageCodegenSuite extends SharedSparkSession
assert(df.collect() === Array(Row(0, 1), Row(2, 1), Row(4, 1)))
}
+ test("SPARK-61661: HashAggregate codegen references do not serialize plan
nodes") {
+ // The references of the generated code are serialized into every task
binary. A plan node
+ // among them would drag its whole child subtree along (for the final
aggregate, the whole
+ // map-side plan through the exchange), so the generated code must not
reference one.
+ def serializedPlanNodes(stage: WholeStageCodegenExec): Seq[String] = {
+ val planNodes = mutable.ArrayBuffer[String]()
+ val out = new ObjectOutputStream(new ByteArrayOutputStream()) {
+ enableReplaceObject(true)
+ override def replaceObject(obj: AnyRef): AnyRef = {
+ obj match {
+ case p: SparkPlan => planNodes += p.nodeName
+ case _ =>
+ }
+ obj
+ }
+ }
+ out.writeObject(stage.doCodeGen()._1.references.toArray)
Review Comment:
Updated. The test now serializes the RDD that the stage adds on top of its
input RDDs, which is its closure or `WholeStageCodegenEvaluatorFactory`
together with the code references, with the parent RDDs cut off. It runs with
`spark.sql.execution.usePartitionEvaluator` both on and off, and still fails
without this change.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]