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

   Thank you for the review, @dongjoon-hyun. I pushed a commit addressing all 
of it.
   
   - **Swap `ctx.currentVars` instead of mutating `input`**: done, as you 
suggested. Added `GeneratePredicateHelper.subExprStatesToEliminate`, which 
swaps `ctx.currentVars` for copies with blank code, generates the states, and 
restores it in a `finally`. `input` is no longer touched, so the `toIndexedSeq` 
snapshot, the restore loop, and the `LazyList` sub-test are all gone.
   - **Emit `evaluateVariables(exprCodesNeedEvaluate)` instead of asserting**: 
done. The helper returns it with the states and `doConsume` emits it. With the 
blank copies it is always empty, so it is a no-op that still guards a future 
change that hoists a column, without an `AssertionError` that could not fall 
back.
   - **`try`/`finally` for the restore**: done, inside the helper.
   - **One helper so callers cannot violate the precondition**: done. The 
hiding and the state generation are in `subExprStatesToEliminate`; 
`generatePredicateCode`'s doc states the precondition and the helper satisfies 
it.
   - **Inaccurate comment**: fixed. You are right that 
`getLocalInputVariableValues` clears `input.code` in both the inline and the 
split cases, so the conjunct does not re-declare the column. The comment now 
states the two real failures: a conjunct before the first state that reads a 
column reads it undeclared, and two states reading the same column declare it 
twice.
   - **Verify the CSE path per shape**: done. Each of the four shapes now 
asserts the generated code differs with the config on and off, and the test 
checks the states are split into functions at `methodSplitThreshold` 1 and kept 
inline at `Int.MaxValue`.
   - **nits**: "a method and up to two mutable fields" and the `SQLConf` doc 
reflow are both applied.
   


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