xiangfu0 commented on code in PR #10708:
URL: https://github.com/apache/pinot/pull/10708#discussion_r1185570380


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/plan/serde/QueryPlanSerDeUtils.java:
##########
@@ -122,7 +134,37 @@ private static Worker.StageMetadata 
toProtoStageMetadata(StageMetadata stageMeta
   private static Worker.WorkerMetadata toProtoWorkerMetadata(WorkerMetadata 
workerMetadata) {
     Worker.WorkerMetadata.Builder builder = Worker.WorkerMetadata.newBuilder();
     
builder.setVirtualAddress(addressToProto(workerMetadata.getVirtualServerAddress()));
+    
builder.putAllMailboxMetadata(toProtoMailboxMap(workerMetadata.getMailBoxInfosMap()));
     builder.putAllCustomProperty(workerMetadata.getCustomProperties());
     return builder.build();
   }
+
+  private static Map<Integer, Worker.MailboxMetadata> toProtoMailboxMap(
+      Map<Integer, List<MailboxMetadata>> mailBoxInfosMap) {
+    Map<Integer, Worker.MailboxMetadata> mailboxMetadataMap = new HashMap<>();
+    for (Map.Entry<Integer, List<MailboxMetadata>> entry : 
mailBoxInfosMap.entrySet()) {
+      mailboxMetadataMap.put(entry.getKey(), toProtoMailbox(entry.getValue()));
+    }
+    return mailboxMetadataMap;
+  }
+
+  private static Worker.MailboxMetadata toProtoMailbox(List<MailboxMetadata> 
mailboxMetadataList) {
+    Worker.MailboxMetadata.Builder builder = 
Worker.MailboxMetadata.newBuilder();
+    for (MailboxMetadata mailboxMetadata : mailboxMetadataList) {
+      builder.addMailboxId(mailboxMetadata.getMailBoxId());
+      
builder.addVirtualAddress(mailboxMetadata.getVirtualAddress().toString());
+      mailboxMetadata.getCustomProperties().entrySet().stream().forEach(
+          entry -> builder.putCustomProperty(
+              
toMailboxCustomPropertiesKeyPrefix(mailboxMetadata.getMailBoxId(), 
entry.getKey()), entry.getValue()));
+    }
+    return builder.build();
+  }
+
+  private static String toMailboxCustomPropertiesKeyPrefix(String mailBoxId, 
String key) {
+    return String.format("%s.%s", mailBoxId, key);
+  }
+
+  private static String fromMailboxCustomPropertiesKeyPrefix(String mailBoxId, 
String key) {
+    return key.split(mailBoxId + "\\.")[1];
+  }

Review Comment:
   Made proto and java class in sync for mailboxMetadata.



-- 
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]

Reply via email to