Github user rednaxelafx commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20224#discussion_r163947756
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/WholeStageCodegenExec.scala
 ---
    @@ -471,19 +531,21 @@ case class WholeStageCodegenExec(child: SparkPlan) 
extends UnaryExecNode with Co
             }
            """, inlineToOuterClass = true)
     
    +    val className = generatedClassName()
    +
         val source = s"""
           public Object generate(Object[] references) {
    -        return new GeneratedIterator(references);
    +        return new $className(references);
           }
     
           ${ctx.registerComment(s"""Codegend pipeline 
for\n${child.treeString.trim}""")}
    -      final class GeneratedIterator extends 
org.apache.spark.sql.execution.BufferedRowIterator {
    +      final class $className extends 
${classOf[BufferedRowIterator].getName} {
    --- End diff --
    
    Yes, that's a great idea that I missed! Thanks for your comments, @kiszk !
    
    We can get that effect in two ways:
    1. Change the current line `${ctx.registerComment(s"""Codegend pipeline 
for\n${child.treeString.trim}""")}` from `child.treeString` to 
this.treeString`, which will include the codegen stage ID through the 
`treeString`, just like the explain output.
    2. Simply add `$codegenStageId` into the `Codegend pipeline for` line.
    3. Do both above. (Did I say two...?)
    
    Which do you prefer?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to