gortiz opened a new pull request, #20359: URL: https://github.com/apache/pinot/pull/20359
## Summary **What.** `MultiStageStatsTreeEncoder` now encodes the stats of a leaf stage whose pipeline breaker child has more than one operator. Before this change, the encoder threw `IllegalStateException` for such a stage. **Why.** When the encoder throws, the server reports the opchain as complete with no stats. The broker then counts the opchain as responded, so `streamStatsCoverage` shows full coverage. But it renders the stage as `EMPTY_MAILBOX_SEND`, and the stats of the stage are lost. The Java engine always gives a pipeline breaker one child: a single `MAILBOX_RECEIVE`. The encoder assumed this shape. A pluggable opchain (for example a native engine) can lower the pipeline breaker child to a chain of operators, such as a root adaptor over a receive. **How.** The leaf folds the pipeline breaker stats as a flat prefix: ``` [ <child 0 subtree, pre-order> , PIPELINE_BREAKER , LEAF ... ] ``` The encoder used to expect exactly one `MAILBOX_RECEIVE` entry before `PIPELINE_BREAKER`. It now counts the operators of the first child subtree (`countOperators`) and expects `PIPELINE_BREAKER` right after them. It grafts that subtree under the pipeline breaker node. Only the first child is kept, because `PipelineBreakerOperator.calculateUpstreamStats` keeps only the entries of its first child. The method `keptPipelineBreakerReceives` is renamed to `keptPipelineBreakerChildren`. ## Validation - New `MultiStageStatsTreeEncoderTest#testPipelineBreakerGraftWithMultiOperatorChild`: a pipeline breaker child with two operators (`TRANSFORM` over `MAILBOX_RECEIVE`). It fails without the fix with `Expected a PIPELINE_BREAKER entry after 1 leading MAILBOX_RECEIVE entries ... found TRANSFORM`. - `MultiStageStatsTreeEncoderTest` (8 tests) and `StreamStatsReportingIntegrationTest` (7 tests) pass. - Spotless, license and checkstyle pass on `pinot-query-runtime`. 🤖 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]
