FrankChen021 opened a new pull request, #20630: URL: https://github.com/apache/druid/pull/20630
### Description `PlannerContext` stored the query context as a mutable map, and every `queryContext()` call built a new `QueryContext` (a sorted copy) from it. `queryContext()` is called many times during planning. This PR makes `PlannerContext` hold a single immutable `QueryContext` and return it directly: - `queryContextMap()` now returns an immutable snapshot. - The four places that wrote into that map during planning (INSERT/REPLACE segment granularity, catalog `rowsPerSegment`, REPLACE time chunks, export file format) now use the new `PlannerContext#setQueryContextParameter`, which replaces the context with an overridden copy. - Added `QueryContext#override(QueryContextParameter<T>, T)`. It, and the existing `override(Map)`, now copy the context once instead of twice, and still keep keys sorted. - Removed the unused `PlannerContext#addAllToQueryContext`. <hr> This PR has: - [x] been self-reviewed. - [x] added unit tests or modified existing tests to cover new code paths. -- 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]
