gortiz commented on code in PR #14507: URL: https://github.com/apache/pinot/pull/14507#discussion_r1895396466
########## pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/exchange/BlockExchange.java: ########## @@ -137,4 +165,66 @@ public void cancel(Throwable t) { sendingMailbox.cancel(t); } } + + public SendingMailbox asSendingMailbox(String id) { + return new BlockExchangeSendingMailbox(id); + } + + /** + * A mailbox that sends data blocks to a {@link org.apache.pinot.query.runtime.operator.exchange.BlockExchange}. + * + * BlockExchanges send data to a list of {@link SendingMailbox}es, which are responsible for sending the data + * to the corresponding {@link ReceivingMailbox}es. This class applies the decorator pattern to expose a BlockExchange + * as a SendingMailbox, open the possibility of having a BlockExchange as a destination for another BlockExchange. + * + * This is useful for example when a send operator has to send data to more than one stage. We need to broadcast the + * data to all the stages (the first BlockExchange). Then for each stage, we need to send the data to the + * corresponding workers (the inner BlockExchange). The inner BlockExchange may send data using a different + * distribution strategy. + * + * @see MailboxSendNode#isMultiSend()} + */ + private class BlockExchangeSendingMailbox implements SendingMailbox { Review Comment: Yeah, it was great to find we could use decoration here. Kudos to the one that created the interface! -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org