You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/06/16 00:53:16 UTC

[GitHub] [spark] maropu commented on a change in pull request #28715: [SPARK-31897][SQL]Enable codegen for GenerateExec

maropu commented on a change in pull request #28715:
URL: https://github.com/apache/spark/pull/28715#discussion_r440525221



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/GenerateExec.scala
##########
@@ -226,18 +226,33 @@ case class GenerateExec(
       "0"
     }
     val numOutput = metricTerm(ctx, "numOutputRows")
+    val requiredInput =
+      evaluateRequiredVariablesExpr(child.output,
+        input, parent.inputSet) ++ position ++ values
     s"""
        |${data.code}
        |$initMapData
        |int $numElements = ${data.isNull} ? 0 : ${data.value}.numElements();
        |for (int $index = $init; $index < $numElements; $index++) {
        |  $numOutput.add(1);
        |  $updateRowData
-       |  ${consume(ctx, input ++ position ++ values)}
+       |  ${consume(ctx, requiredInput)}
        |}
      """.stripMargin
   }
 
+  /**
+   * Returns [ExprCode] for required attributes
+   */
+  private def evaluateRequiredVariablesExpr(

Review comment:
       How about inlining this method in the caller side? Btw, why do we need this method? It seems https://github.com/apache/spark/commit/b5c5bd98ea5e8dbfebcf86c5459bdf765f5ceb53 doesn't have this logic though.




----------------------------------------------------------------
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:
users@infra.apache.org



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