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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]