schenksj opened a new pull request, #4535:
URL: https://github.com/apache/datafusion-comet/pull/4535
## Which issue does this PR close?
Closes #4530.
## Rationale for this change
`PlanDataInjector.injectPlanData` walked every operator in the tree against
every registered injector:
```scala
for (injector <- injectors if injector.canInject(op)) { ... }
```
That is N operators × M injectors `canInject` calls, even though most
operators in any tree are non-scan and match no injector.
This is an independent micro-optimization, extracted from the Delta Lake
contrib integration branch (which registers a third injector) purely to keep
that PR focused; there is no functional dependency.
## What changes are included in this PR?
- Add `def opStructCase: Operator.OpStructCase` to the `PlanDataInjector`
trait, implemented by `IcebergPlanDataInjector` (`ICEBERG_SCAN`) and
`NativeScanPlanDataInjector` (`NATIVE_SCAN`).
- Build a `Map[Operator.OpStructCase, PlanDataInjector]` and look up by
`op.getOpStructCase` (O(1)), then run a single `canInject` confirm (which still
inspects detail fields like `hasCommon` / `!hasFilePartition`). Non-scan
operators skip the iteration entirely.
Pure performance change — no behavior difference.
## How are these changes tested?
- New `PlanDataInjectorSuite`: asserts a non-scan operator tree passes
through `injectPlanData` unchanged (exercises the O(1) miss path), and that
each registered injector resolves back to itself via its declared
`opStructCase` (the kinds are distinct and the map is complete, so no injector
is silently shadowed).
- `CometExecSuite` (126/0), which exercises native-scan plan-data injection
end-to-end on every native query, passes unchanged — confirming the refactor
preserves behavior.
--
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]