LukaZdravic opened a new pull request, #58701: URL: https://github.com/apache/spark/pull/58701
**Draft — depends on SPARK-59326.** This PR builds on the `RewriteAsOfJoinSuite` changes from SPARK-59326 (the forward/nearest tolerance tests) and refactors the whole suite onto a shared helper. ### What changes were proposed in this pull request? Test-only change that expands and refactors `RewriteAsOfJoinSuite`, the unit test suite for the `RewriteAsOfJoin` optimizer rule: - Introduce a shared `expectedRewrite(filter, orderExpression, joinType)` helper so each test spells out only the parts that vary (the as-of condition and the ordering distance), removing ~15 lines of duplicated plan-building per test. - Fix the `"left outer"` test, which built an `Inner` join (a silent duplicate of `"simple"`); it now builds a real `LeftOuter` join, isolating the one behavior LeftOuter changes (omitting the `IS NOT NULL` filter). - Add the one missing `(direction, tolerance, allowExactMatches)` combination: `nearest` + `allowExactMatches = false` + no tolerance, whose as-of condition is `NOT(left = right)`. - Add negative/no-op coverage for the rule's guard `!conf.useSortMergeAsOfJoinOperator(requiresSortMergeAsOfJoin)`, covering both triggers: the `requiresSortMergeAsOfJoin` node flag and the sort-merge as-of config. - Add a test that places a `Project` above the `AsOfJoin` so the attribute remapping performed by `transformUpWithNewOutput` is exercised. ### Why are the changes needed? The suite covered only positive rewrites and left several parts of the rule untested: one direction/tolerance/exact-match combination was missing, the `"left outer"` test did not actually test `LeftOuter`, the no-op guard had no coverage, and the parent-operator attribute remapping was never exercised. The sibling rule's suite (`RewriteNearestByJoinSuite`) already covers these categories; this brings `RewriteAsOfJoinSuite` up to the same bar. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Unit tests in `RewriteAsOfJoinSuite`: `build/sbt 'catalyst/testOnly *RewriteAsOfJoinSuite'` (17 tests). ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 4.8) -- 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]
