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 2021/06/26 16:22:54 UTC
[GitHub] [spark] AngersZhuuuu commented on a change in pull request #33082: [SPARK-35886][SQL] CodeGenerator.getLocalInputVariableValues should handle case that expression match SubExprEliminationState but not VariableValue
AngersZhuuuu commented on a change in pull request #33082:
URL: https://github.com/apache/spark/pull/33082#discussion_r659189132
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
##########
@@ -1766,19 +1766,20 @@ object CodeGenerator extends Logging {
argSet += JavaCode.variable(ctx.INPUT_ROW, classOf[InternalRow])
}
+ val stack = mutable.Stack[Expression](expr)
+
// Collects local variables from a given `expr` tree
- val collectLocalVariable = (ev: ExprValue) => ev match {
+ val collectLocalVariable = (ev: ExprValue, e: Expression) => ev match {
case vv: VariableValue => argSet += vv
- case _ =>
+ case _ => stack.pushAll(e.children)
}
- val stack = mutable.Stack[Expression](expr)
while (stack.nonEmpty) {
stack.pop() match {
case e if subExprs.contains(e) =>
val SubExprEliminationState(isNull, value) = subExprs(e)
- collectLocalVariable(value)
- collectLocalVariable(isNull)
+ collectLocalVariable(value, e)
+ collectLocalVariable(isNull, e)
Review comment:
> Oh, some `SubExprEliminationState` contains not `VariableValue` but still some statements that includes other expressions?
Yes, the expression contains input var may match `SubExprEliminationState` and just skiped.
--
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: reviews-unsubscribe@spark.apache.org
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