Akanksha-kedia opened a new pull request, #18514:
URL: https://github.com/apache/pinot/pull/18514
## Description
Adds a new `broadcast_right` join strategy hint for the multi-stage query
engine. This strategy explicitly broadcasts the right side of a join to all
workers while hash-distributing (or random-distributing for non-equi joins) the
left side. It is designed for star-schema patterns where the right (dimension)
table is small enough to fit in memory but is **not** pre-replicated as a
dimension table — filling the gap between the existing `hash` and `lookup`
strategies.
## Related Issue
Partially addresses #14518 (item 2: "Broadcast the right table, and join on
left table local worker")
## Changes Made
- **`PinotHintOptions.java`** — Added `BROADCAST_RIGHT_JOIN_STRATEGY`
constant and `useBroadcastRightJoinStrategy()` helper method.
- **`PinotJoinExchangeNodeInsertRule.java`** — Handle the new hint in the
exchange-insertion rule: left side gets hash (or random for non-equi)
distribution, right side gets broadcast distribution.
- **`TraitAssignment.java`** — Assign correct distribution traits when
`broadcast_right` hint is present (parallel to existing lookup join handling).
- **`RelToPlanNodeConverter.java`** — Map the hint to
`JoinNode.JoinStrategy.BROADCAST_RIGHT` in the v1 logical-to-physical converter.
- **`PRelToPlanNodeConverter.java`** — Map the hint to
`JoinNode.JoinStrategy.BROADCAST_RIGHT` in the v2 physical planner converter.
- **`JoinNode.java`** — Added `BROADCAST_RIGHT` to the `JoinStrategy` enum.
- **`QueryCompilationTest.java`** — Added two tests covering equi-join (hash
left + broadcast right) and non-equi-join (random left + broadcast right)
scenarios.
## Usage
```sql
SELECT /*+ joinOptions(join_strategy='broadcast_right') */
f.order_id, d.product_name
FROM fact_orders f
JOIN dim_products d ON f.product_id = d.product_id
```
## Testing Done
- [x] Unit tests added (`testBroadcastRightJoinHintEquiJoin`,
`testBroadcastRightJoinHintNonEquiJoin`)
- [x] Tests verify both distribution types (HASH/RANDOM for left, BROADCAST
for right) and the `BROADCAST_RIGHT` join strategy in the plan node
- [x] Existing tests pass — the change is purely additive and does not
modify any existing code paths
## Documentation
- [ ] Documentation update can follow in a separate PR once the strategy is
finalized
## Checklist
- [x] Code follows project style guidelines
- [x] Self-review completed
- [x] No new warnings introduced
- [x] Backward compatible — new enum value is additive; no existing behavior
changed
- [x] Works with both v1 (`RelToPlanNodeConverter`) and v2
(`PRelToPlanNodeConverter`) physical planners
--
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]