zml1206 opened a new pull request, #44573:
URL: https://github.com/apache/spark/pull/44573
### What changes were proposed in this pull request?
Remove `attachCleanupResourceChecker` in `JoinSuite`.
### Why are the changes needed?
`attachCleanupResourceChecker` is invalid:
1. The matching of `SortExec` needs to be in `QueryExecution.executePlan`
not `QueryExecution.sparkPlan`, The correct way is
`foreachUp(df.queryExecution.executedPlan){f()}`.
2. `Mockito` counts the number of function calls, only for objects after
spying. Calls to the original object are not counted. eg
```
test() {
val data = new java.util.ArrayList[String]()
val _data = spy(data)
data.add("a");
data.add("b");
data.add("b");
_data.add("b")
verify(_data, times(0)).add("a")
verify(_data, times(1)).add("b")
}
```
Therefore, when using `df.queryExecution.executedPlan` correctly to match,
count is always one.
3. Not all `SortMergeJoin` joinTypes will trigger cleanupResources(), such
as 'full outer join'.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Local test, update `attachCleanupResourceChecker` atLeastOnce to nerver, ut
is still successful.
```
verify(sortExec, atLeastOnce).cleanupResources()
verify(sortExec.rowSorter, atLeastOnce).cleanupResources()
```
to
```
verify(sortExec, never).cleanupResources()
verify(sortExec.rowSorter, never).cleanupResources()
```
### Was this patch authored or co-authored using generative AI tooling?
No.
--
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]