Skip to content

Allow subclasses to intercept BrokerResponse via overridable onQueryCompletion hook #18248

@st-omarkhalid

Description

@st-omarkhalid

Problem

The BrokerQueryEventListener SPI only receives RequestContext in onQueryCompletion(RequestContext). Several fields that are fully populated only after query execution — isPartialResult(), getPools(), getRLSFiltersApplied(), getTablesQueried(), isNumGroupsWarningLimitReached() — are only available on BrokerResponse, not on RequestContext.

This makes it impossible for downstream implementations (e.g. async query-log pipelines) to capture the complete query metadata without modifying the SPI.

Proposed Solution

  1. Add a protected onQueryCompletion(RequestContext, BrokerResponse) hook to BaseBrokerRequestHandler. The default implementation delegates to the existing SPI listener (no behaviour change). Subclasses can override to intercept the full response.

  2. Add a protected createSingleStageBrokerRequestHandler(...) factory method to BaseBrokerStarter so subclasses can inject a custom handler that overrides the hook. Follows the same pattern as the existing createWorkerManager(...) factory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions