viirya commented on a change in pull request #32980:
URL: https://github.com/apache/spark/pull/32980#discussion_r660744333



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
##########
@@ -1071,14 +1133,13 @@ class CodegenContext extends Logging {
       (inputVars.toSeq, exprCodes.toSeq)
     }.unzip
 
-    val splitThreshold = SQLConf.get.methodSplitThreshold
-
-    val (codes, subExprsMap, exprCodes) = if 
(nonSplitExprCode.map(_.length).sum > splitThreshold) {
+    val needSplit = nonSplitCode.map(_.eval.code.length).sum > 
SQLConf.get.methodSplitThreshold
+    val (subExprsMap, exprCodes) = if (needSplit) {

Review comment:
       Previously it is lazy so we can do non-split conditionally. Now we 
nestedly generate subExprs so it cannot be lazy now. `SubExprEliminationStates` 
are needed to nestedly generate code for them.




-- 
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]

Reply via email to