yihua opened a new pull request, #20069: URL: https://github.com/apache/hudi/pull/20069
### Describe the issue this Pull Request addresses closes #20065 part of #20064 Engine-agnostic code in `hudi-client-common` (indexes, table services, metadata table writers) cannot share read-only state with tasks, so task functions capture the `HoodieTable`, the write config or the meta client, and every task deserializes its own copy. Spark code works around this with `jsc.broadcast`, which engine-agnostic code cannot call. ### Summary and Changelog Adds `HoodieBroadcast<T>` and `HoodieEngineContext#broadcast(T)`. The default holds the value in the handle, which fits engines that run tasks in the current JVM (local, Java, Flink). `HoodieSparkEngineContext` returns a `HoodieSparkBroadcast`: a Spark broadcast of the value's bytes (closure serializer, so serialization matches a closure capture regardless of `spark.serializer`), deserialized once per executor; the driver-side handle returns the driver's instance. Unit tests cover every engine context, including that a closure capturing the handle stays small and that Spark tasks read one deserialized copy. Later PRs in the epic (index lookups, metadata table, Spark write stage, table services) stack on this one. ### Impact New public API only; no change to existing code paths. ### Risk Level low. Additive; the default implementation is an identity holder and existing engine context subclasses keep compiling. ### Documentation Update none ### Contributor's checklist - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [ ] Enough context is provided in the sections above - [ ] Adequate tests were added if applicable -- 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]
