Skip to content

[Data] Preserve anti-join rows with an empty unknown-schema side - #66126

Merged
richardliaw merged 5 commits into
ray-project:masterfrom
viiccwen:fix-data-empty-side-anti-join
Sep 14, 2026
Merged

richardliaw merged 5 commits into
ray-project:masterfrom
viiccwen:fix-data-empty-side-anti-join

Conversation

@viiccwen

@viiccwen viiccwen commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

ShuffleV2 currently skips a join partition when one side has no blocks and its schema cannot be inferred. For left and right anti-joins, it's exception.

When the unknown side of an anti-join is empty, this change synthesizes its join-key schema from the known side. The reducer can then use the normal join path and preserve the unmatched rows as expected.

Edit: also narrow the schema type.

Related issues

closes #66125.

Synthesize a typed empty join-key table when one anti-join side has no blocks and its schema cannot be inferred. This lets shuffle V2 run the normal join path instead of dropping rows from the preserved side.

Add coverage for both left and right anti joins with an unknown-schema empty input.

Signed-off-by: viiccwen <[email protected]>
@viiccwen
viiccwen requested a review from a team as a code owner September 12, 2026 07:03
@viiccwen

Copy link
Copy Markdown
Contributor Author

Hello @owenowenisme, PTAL. 🫡

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an issue in anti joins where an empty side with an unknown schema would cause the preserved side's rows to be silently dropped. It resolves this by synthesizing the empty side's schema from the known side during left and right anti joins, and adds a corresponding test case. The review feedback suggests converting the key column name tuples to lists when calling PyArrow's select and rename_columns methods to ensure strict type compatibility.

@owenowenisme owenowenisme self-assigned this Sep 12, 2026
@ray-gardener ray-gardener Bot added data Ray Data-related issues community-contribution Contributed by the community labels Sep 12, 2026
Synthesize an empty join-key table whenever exactly one shuffle V2 join side has no blocks and no inferred schema. This lets the normal PyArrow join path preserve outer-join and anti-join semantics while keeping inner and semi joins empty.\n\nFactor the schema synthesis into a helper and extend coverage across all join types and both empty-side positions.

Signed-off-by: viiccwen <[email protected]>
@viiccwen

Copy link
Copy Markdown
Contributor Author

@owenowenisme Thx for reviewing! Updated.

Signed-off-by: You-Cheng Lin <[email protected]>
@owenowenisme
owenowenisme force-pushed the fix-data-empty-side-anti-join branch from 927e099 to bfe30df Compare September 14, 2026 04:24
@owenowenisme owenowenisme added the go add ONLY when ready to merge, run all tests label Sep 14, 2026
Use Ray Data's Schema union for the join reducer inputs and local side-table helper instead of Any. This documents the accepted Arrow/Pandas schema contract while preserving the existing runtime check for Arrow schemas.

Signed-off-by: viiccwen <[email protected]>
Convert join-key name tuples to lists before calling PyArrow table APIs. PyArrow 17 requires a list for rename_columns, while newer local versions also accept tuples.

Signed-off-by: viiccwen <[email protected]>
@viiccwen

Copy link
Copy Markdown
Contributor Author

@owenowenisme it could be cleanly merged!

@richardliaw
richardliaw merged commit f7c2c05 into ray-project:master Sep 14, 2026
6 checks passed
@viiccwen
viiccwen deleted the fix-data-empty-side-anti-join branch September 15, 2026 00:58
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…-project#66126)

## Description

ShuffleV2 currently skips a join partition when one side has no blocks
and its schema cannot be inferred. For left and right anti-joins, it's
exception.

When the unknown side of an anti-join is empty, this change synthesizes
its join-key schema from the known side. The reducer can then use the
normal join path and preserve the unmatched rows as expected.

Edit: also narrow the schema type.

## Related issues

closes ray-project#66125.

---------

Signed-off-by: viiccwen <[email protected]>
Signed-off-by: You-Cheng Lin <[email protected]>
Co-authored-by: You-Cheng Lin <[email protected]>
chia7712 pushed a commit to opensource4you/readme that referenced this pull request Oct 23, 2026
Add a nomination under `fellowship/ray/`

Suggested level: 30k

Highlights from 2026-09-01 to 2026-10-11:

- [Contribution](https://github.com/opensource4you/readme/blob/main/fellowship/ray/fellow-contribution/viiccwen/September/report.md)
- Merged 10 Ray Data PRs and filed 8 issues in 6 weeks
- Made shuffle tasks up to 12.84x faster by pinning the fused map function, so large UDF closures are no longer serialized again for every shuffle task ([#65480](ray-project/ray#65480))
- Built a memory observability series to help users avoid OOM: exported task peak USS and logical memory metrics with Grafana charts ([#65666](ray-project/ray#65666), [#66044](ray-project/ray#66044)), added a warning with a suggested memory value when it is set below 1.25x max USS ([#65512](ray-project/ray#65512)), and updated the OOM prevention docs ([#65509](ray-project/ray#65509))
- Found, reported and fixed silent data loss in hash-shuffle (V2) anti joins, where rows were dropped when the other side was empty and had an unknown schema ([#66126](ray-project/ray#66126))
- Reviewed other fellows' PRs with suggestions ([#66878](ray-project/ray#66878))
- Merged the most PRs and filed the most issues of all Ray Fellowship participants
- Solid work for an early contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Data] Anti joins drop rows when the empty side has an unknown schema

3 participants