gortiz commented on code in PR #14495: URL: https://github.com/apache/pinot/pull/14495#discussion_r1850587411
########## pinot-query-planner/src/main/java/org/apache/pinot/query/planner/plannode/MailboxSendNode.java: ########## @@ -50,8 +53,42 @@ public MailboxSendNode(int stageId, DataSchema dataSchema, List<PlanNode> inputs _sort = sort; } + public MailboxSendNode(int stageId, DataSchema dataSchema, List<PlanNode> inputs, + int receiverStage, PinotRelExchangeType exchangeType, + RelDistribution.Type distributionType, @Nullable List<Integer> keys, boolean prePartitioned, + @Nullable List<RelFieldCollation> collations, boolean sort) { + this(stageId, dataSchema, inputs, toBitSet(receiverStage), exchangeType, distributionType, keys, prePartitioned, + collations, sort); + } + + private static BitSet toBitSet(int receiverStage) { + BitSet bitSet = new BitSet(receiverStage + 1); + bitSet.set(receiverStage); + return bitSet; + } + + public MailboxSendNode(int stageId, DataSchema dataSchema, List<PlanNode> inputs, + PinotRelExchangeType exchangeType, RelDistribution.Type distributionType, @Nullable List<Integer> keys, + boolean prePartitioned, @Nullable List<RelFieldCollation> collations, boolean sort) { + this(stageId, dataSchema, inputs, null, exchangeType, distributionType, keys, prePartitioned, collations, sort); + } + + public BitSet getReceiverStages() { + Preconditions.checkState(!_receiverStages.isEmpty(), "Receivers not set"); + return (BitSet) _receiverStages.clone(); + } Review Comment: Oh! I misread you. I though the code wasn't returning a copy and you wanted to say that the returned BitSet should not be modified. About your actual comment: I don't think that needs to be commented. Specifically, I think that should be the default. Even if we don't do defensive copies, by default we should never modify structures returned by objects. It is a bit like annotating with `@NotNull`. In the same way we assume that everything is not nullable by default, we should assume we should not change mutable properties by default. -- 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