Skip to content

[SPARK-59890][SQL][TESTS] Replace ResolveAsOfJoinSuite with end-to-end ASOF JOIN tests - #59158

Closed
LukaZdravic wants to merge 1 commit into
apache:masterfrom
LukaZdravic:asof-remove-resolve-suite
Closed

LukaZdravic wants to merge 1 commit into
apache:masterfrom
LukaZdravic:asof-remove-resolve-suite

Conversation

@LukaZdravic

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Remove ResolveAsOfJoinSuite. It unit-tests only the fixed-point analyzer rule ResolveAsOfJoin: it builds plans by hand and checks internal expression shapes, for example that the MATCH_CONDITION distance is a Subtract or a ZipWith.

Add one end-to-end test to AsOfJoinSQLSuite for the only behavior no other test checked: INNER ASOF JOIN keeps a NOT NULL right column NOT NULL, and LEFT ASOF JOIN makes it nullable.

Why are the changes needed?

The suite does not test the single-pass resolver (AsOfJoinResolver), which calls the same MATCH_CONDITION code. It also pins internal shapes, so an internal change must edit it even when no query result changes. SPARK-59749 had to.

End-to-end tests already cover the other 19 of its 20 cases: the operators and the match per operand type (join-asof-grammar.sql, join-asof-datatypes.sql, AsOfJoinSortMergeSQLSuite), USING and ON (join-asof-grammar.sql, join-asof-semantics.sql), and the rejected operands (join-asof-errors.sql, AsOfJoinSQLSuite). In tests, these queries run both analyzers where the single-pass resolver supports them, and fail if the plans differ (spark.sql.analyzer.singlePassResolver.dualRunWithLegacy is on while testing).

Does this PR introduce any user-facing change?

No. Test-only change.

How was this patch tested?

Ran the ASOF JOIN suites (AsOfJoinSQLSuite, AsOfJoinSortMergeSQLSuite, AsOfJoinMatchConditionTypesSuite, RewriteAsOfJoinSuite, SortMergeAsOfJoinSuite, DataFrameAsOfJoinSuite, StreamingAsOfJoinSuite) and SQLQueryTestSuite, which includes the join-asof-*.sql golden files.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code

This pull request and its description were written by Isaac.

…d ASOF JOIN tests

Remove ResolveAsOfJoinSuite. It tests only the fixed-point ResolveAsOfJoin rule
and pins internal expression shapes. End-to-end tests already cover 19 of its
20 cases, and in tests they also run the single-pass resolver.

Add an AsOfJoinSQLSuite test for the last case: INNER ASOF JOIN keeps a NOT NULL
right column NOT NULL, and LEFT ASOF JOIN makes it nullable.

Co-authored-by: Isaac <no-reply@databricks.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 15:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@uros-b uros-b closed this in f74ba34 Oct 1, 2026
uros-b pushed a commit that referenced this pull request Oct 1, 2026
… ASOF JOIN tests

### What changes were proposed in this pull request?

Remove `ResolveAsOfJoinSuite`. It unit-tests only the fixed-point analyzer rule `ResolveAsOfJoin`: it builds plans by hand and checks internal expression shapes, for example that the `MATCH_CONDITION` distance is a `Subtract` or a `ZipWith`.

Add one end-to-end test to `AsOfJoinSQLSuite` for the only behavior no other test checked: `INNER ASOF JOIN` keeps a NOT NULL right column NOT NULL, and `LEFT ASOF JOIN` makes it nullable.

### Why are the changes needed?

The suite does not test the single-pass resolver (`AsOfJoinResolver`), which calls the same `MATCH_CONDITION` code. It also pins internal shapes, so an internal change must edit it even when no query result changes. SPARK-59749 had to.

End-to-end tests already cover the other 19 of its 20 cases: the operators and the match per operand type (`join-asof-grammar.sql`, `join-asof-datatypes.sql`, `AsOfJoinSortMergeSQLSuite`), `USING` and `ON` (`join-asof-grammar.sql`, `join-asof-semantics.sql`), and the rejected operands (`join-asof-errors.sql`, `AsOfJoinSQLSuite`). In tests, these queries run both analyzers where the single-pass resolver supports them, and fail if the plans differ (`spark.sql.analyzer.singlePassResolver.dualRunWithLegacy` is on while testing).

### Does this PR introduce _any_ user-facing change?

No. Test-only change.

### How was this patch tested?

Ran the ASOF JOIN suites (`AsOfJoinSQLSuite`, `AsOfJoinSortMergeSQLSuite`, `AsOfJoinMatchConditionTypesSuite`, `RewriteAsOfJoinSuite`, `SortMergeAsOfJoinSuite`, `DataFrameAsOfJoinSuite`, `StreamingAsOfJoinSuite`) and `SQLQueryTestSuite`, which includes the `join-asof-*.sql` golden files.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code

This pull request and its description were written by Isaac.

Closes #59158 from LukaZdravic/asof-remove-resolve-suite.

Authored-by: Luka Zdravić <lukazdravic10@gmail.com>
Signed-off-by: Uros Bojanic <221401595+uros-b@users.noreply.github.com>
(cherry picked from commit f74ba34)
Signed-off-by: Uros Bojanic <221401595+uros-b@users.noreply.github.com>
@uros-b

uros-b commented Oct 1, 2026

Copy link
Copy Markdown
Member

Merge Summary:

Posted by merge_spark_pr.py

@uros-b

uros-b commented Oct 1, 2026

Copy link
Copy Markdown
Member

Thank you @LukaZdravic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants