sarutak commented on PR #60351:
URL: https://github.com/apache/spark/pull/60351#issuecomment-6818653116

   Thank you for the review. I took the option of keeping the second run with a 
TODO. A TODO for 
[SPARK-61515](https://issues.apache.org/jira/browse/SPARK-61515) is now next to 
the `filterNot` that leaves throwable aliases out of `aliasesSharing` in 
`splitProjectForExpensiveConditions`, and names the follow-up: compute the 
shared part only once. The docstring, the PR description and the test `a Python 
UDF shared with a throwable alias read later runs in both layers`, which checks 
that two projections evaluate the Python UDF, refer to SPARK-61515 too. With 
whole-stage codegen, the example still calls `gt5` 14 times instead of 10. The 
`DataFrameSuite` test `a throwable alias sharing work with an earlier 
condition's alias is computed above that condition's filter` now checks the 14 
calls with the split on, with and without codegen, for `f AND t` and for `f` 
alone.
   
   This PR adds that second run. On the base branch, `aliasesSharing` put `t` 
in the unit of `f`, so the split computed `t` with `f`, below the filter on 
`f`. In the example, that unit held every expensive alias, so the base branch 
did not split at all and the single projection computed `t` on every row. 
Either way, without whole-stage codegen `t` raised on the rows `f` drops. One 
way to run the shared part once is to have `t` read it as a column of the layer 
that computes `f` (in the example `f` itself, as you noted, so no extra column 
is needed), but that is only valid when the alias there evaluates the part 
unconditionally. Under the same condition, the follow-up would also remove the 
second Python evaluation for a shared Python UDF. I would rather do it in 
SPARK-61515 than widen this PR, which changes where the split places the 
conditions.
   


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