gortiz opened a new pull request, #19019: URL: https://github.com/apache/pinot/pull/19019
## Motivation There is currently no generic way for a component to attach a small, non-fatal informational note to a query response (e.g. "this query was executed with an alternate/degraded strategy", "a fallback was applied", diagnostic hints). Today the options are to add a dedicated typed field to `BrokerResponse` for each such case, or to piggyback on `traceInfo` (which is semantically per-server trace strings and not populated for the multi-stage engine). Neither scales. ## Change Add a generic, product-agnostic response-metadata channel: - **`BrokerResponse`**: `getResponseMetadata()` / `putResponseMetadata(...)` — a `Map<String, JsonNode>` (default empty), implemented on `BrokerResponseNativeV2` and serialized as a `responseMetadata` object (omitted when empty). A `String` convenience overload wraps the value in a `TextNode`. Values are arbitrary JSON, so a note can be a scalar, an object, or an array. - **`QueryExecutionContext`**: a concurrent response-metadata sink. Because this context instance is propagated *by reference* across `QueryThreadContext`-aware executors, a writer on an async compile/plan thread is visible when the broker assembles the response. - **`QueryThreadContext.addResponseMetadata(key, value)`**: the registration API (`JsonNode` and `String` overloads). It is a no-op when no query context is active, so callers never need a null check. - **`MultiStageBrokerRequestHandler`**: copies the sink into the response after execution. The core engine attaches no semantics to the keys or values — it is purely an extension point. ## Testing `BrokerResponseNativeV2Test` covers the empty-map case (field omitted from JSON), boolean/string entries, and a nested object value round-tripping through serialization. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
