You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "KKcorps (via GitHub)" <gi...@apache.org> on 2023/03/14 20:00:05 UTC

[GitHub] [pinot] KKcorps commented on a diff in pull request #10413: Refactor: Pass context instead on individual arguments to operator

KKcorps commented on code in PR #10413:
URL: https://github.com/apache/pinot/pull/10413#discussion_r1136125742


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/MailboxReceiveOperator.java:
##########
@@ -66,25 +67,31 @@ public class MailboxReceiveOperator extends MultiStageOperator {
   private int _serverIdx;
   private TransferableBlock _upstreamErrorBlock;
 
-  private static MailboxIdentifier toMailboxId(VirtualServer sender, long jobId, int senderStageId,
-      int receiverStageId, VirtualServerAddress receiver) {
-    return new JsonMailboxIdentifier(
-        String.format("%s_%s", jobId, senderStageId),
-        new VirtualServerAddress(sender),
-        receiver,
-        senderStageId,
-        receiverStageId);
+  private static MailboxIdentifier toMailboxId(VirtualServer sender, long jobId, int senderStageId, int receiverStageId,
+      VirtualServerAddress receiver) {
+    return new JsonMailboxIdentifier(String.format("%s_%s", jobId, senderStageId), new VirtualServerAddress(sender),
+        receiver, senderStageId, receiverStageId);
+  }
+
+  public MailboxReceiveOperator(RelDistribution.Type exchangeType, int senderStageId, int receiverStageId,
+      OpChainExecutionContext context) {
+    this(context.getMetadataMap().get(senderStageId).getServerInstances(), exchangeType, senderStageId, receiverStageId,
+        context);
   }
 
   // TODO: Move deadlineInNanoSeconds to OperatorContext.
-  public MailboxReceiveOperator(MailboxService<TransferableBlock> mailboxService,
-      List<VirtualServer> sendingStageInstances, RelDistribution.Type exchangeType, VirtualServerAddress receiver,
-      long jobId, int senderStageId, int receiverStageId, Long timeoutMs) {
-    super(jobId, senderStageId, receiver);
-    _mailboxService = mailboxService;
+  public MailboxReceiveOperator(List<VirtualServer> sendingStageInstances, RelDistribution.Type exchangeType,
+      int senderStageId, int receiverStageId, OpChainExecutionContext context) {
+    super(context);
+    _mailboxService = context.getMailboxService();
+    VirtualServerAddress receiver = context.getServer();
+    long jobId = context.getRequestId();
     Preconditions.checkState(SUPPORTED_EXCHANGE_TYPES.contains(exchangeType),
         "Exchange/Distribution type: " + exchangeType + " is not supported!");
-    long timeoutNano = (timeoutMs != null ? timeoutMs : QueryConfig.DEFAULT_MAILBOX_TIMEOUT_MS) * 1_000_000L;
+    //TODO: Should I be using the Long.MAX_VALUE here instead of -1 or previous null check?
+    long timeoutNano =
+        (context.getTimeoutMs() != Long.MAX_VALUE ? context.getTimeoutMs() : QueryConfig.DEFAULT_MAILBOX_TIMEOUT_MS)

Review Comment:
   @walterddr What would you prefer here? Should I box the value in context itself? Not sure why it needs to be null 



-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org