gortiz opened a new pull request, #18567:
URL: https://github.com/apache/pinot/pull/18567
## Summary
`PlannerContext` now implements `org.apache.calcite.plan.Context` and passes
itself as the context to both the opt planner and the trait planner.
This allows Calcite rules contributed via the `RuleSetCustomizer` SPI
(#18387) to read per-query options at match time without reflection:
```java
PlannerContext ctx =
call.getPlanner().getContext().unwrap(PlannerContext.class);
String runtime = ctx.getOptions().get("workerRuntime");
```
`unwrap()` also delegates to `_envConfig`, so any code that previously
unwrapped `QueryEnvironment.Config` continues to work unchanged.
A package-private constructor and a `forTesting()` factory method are added
so unit tests can construct a `PlannerContext` without going through
`QueryEnvironment`, and `PlannerContextTest` covers the `unwrap` contract and
verifies that both planners expose the `PlannerContext` instance through their
context.
## Changes
- `PlannerContext` implements `Context`
- Both `_relOptPlanner` and `_relTraitPlanner` receive `this` as their
context
- `unwrap(PlannerContext.class)` and `unwrap(Context.class)` return `this`;
`unwrap(QueryEnvironment.Config.class)` delegates to `_envConfig`
- `forTesting()` factory + package-private constructor for unit testing
- `PlannerContextTest` — 5 tests verifying the `unwrap` contract and planner
context exposure
## Test plan
- [ ] `PlannerContextTest` (5 tests) — all pass
- [ ] Existing `pinot-query-planner` test suite passes
--
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]