walterddr commented on code in PR #10166:
URL: https://github.com/apache/pinot/pull/10166#discussion_r1088078998


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/plan/serde/QueryPlanSerDeUtils.java:
##########
@@ -59,16 +60,26 @@ public static Worker.StagePlan 
serialize(DistributedStagePlan distributedStagePl
         
.putAllStageMetadata(stageMetadataMapToProtoMap(distributedStagePlan.getMetadataMap())).build();
   }
 
+  private static final Pattern VIRTUAL_SERVER_PATTERN = Pattern.compile(
+      
"(?<virtualid>[0-9]+)@(?<host>[^:]+):(?<port>[0-9]+)\\((?<grpc>[0-9]+):(?<service>[0-9]+):(?<mailbox>[0-9]+)\\)");
+
   public static VirtualServer stringToInstance(String serverInstanceString) {
-    String[] s = StringUtils.split(serverInstanceString, '_');
+    Matcher matcher = VIRTUAL_SERVER_PATTERN.matcher(serverInstanceString);
+    if (!matcher.matches()) {
+      throw new IllegalArgumentException("Unexpected serverInstanceString '" + 
serverInstanceString + "'. This might "
+          + "happen if you are upgrading from an old version of the multistage 
engine to the current one in a rolling "
+          + "fashion.");
+    }

Review Comment:
   mark as deprecate? so we can remove after 0.13 release



##########
pinot-query-planner/src/main/java/org/apache/pinot/query/QueryEnvironment.java:
##########
@@ -225,10 +226,11 @@ private RelNode optimize(RelRoot relRoot, PlannerContext 
plannerContext) {
     }
   }
 
-  private QueryPlan toDispatchablePlan(RelRoot relRoot, PlannerContext 
plannerContext, long requestId) {
+  private QueryPlan toDispatchablePlan(RelRoot relRoot, PlannerContext 
plannerContext, long requestId,
+      Map<String, String> options) {
     // 5. construct a dispatchable query plan.
     StagePlanner queryStagePlanner = new StagePlanner(plannerContext, 
_workerManager, requestId, _tableCache);
-    return queryStagePlanner.makePlan(relRoot);
+    return queryStagePlanner.makePlan(relRoot, options);

Review Comment:
   we can pass in the plannerContext as 3rd argument, or simply
   ```suggestion
       return queryStagePlanner.makePlan(relRoot, plannerContext.getOptions());
   ```



##########
pinot-query-planner/src/main/java/org/apache/pinot/query/QueryEnvironment.java:
##########
@@ -225,10 +226,11 @@ private RelNode optimize(RelRoot relRoot, PlannerContext 
plannerContext) {
     }
   }
 
-  private QueryPlan toDispatchablePlan(RelRoot relRoot, PlannerContext 
plannerContext, long requestId) {
+  private QueryPlan toDispatchablePlan(RelRoot relRoot, PlannerContext 
plannerContext, long requestId,
+      Map<String, String> options) {

Review Comment:
   this change is not necessary



##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/plan/serde/QueryPlanSerDeUtils.java:
##########
@@ -59,16 +60,26 @@ public static Worker.StagePlan 
serialize(DistributedStagePlan distributedStagePl
         
.putAllStageMetadata(stageMetadataMapToProtoMap(distributedStagePlan.getMetadataMap())).build();
   }
 
+  private static final Pattern VIRTUAL_SERVER_PATTERN = Pattern.compile(
+      
"(?<virtualid>[0-9]+)@(?<host>[^:]+):(?<port>[0-9]+)\\((?<grpc>[0-9]+):(?<service>[0-9]+):(?<mailbox>[0-9]+)\\)");
+
   public static VirtualServer stringToInstance(String serverInstanceString) {
-    String[] s = StringUtils.split(serverInstanceString, '_');
+    Matcher matcher = VIRTUAL_SERVER_PATTERN.matcher(serverInstanceString);
+    if (!matcher.matches()) {
+      throw new IllegalArgumentException("Unexpected serverInstanceString '" + 
serverInstanceString + "'. This might "
+          + "happen if you are upgrading from an old version of the multistage 
engine to the current one in a rolling "
+          + "fashion.");
+    }
+
     // Skipped netty and grpc port as they are not used in worker instance.
-    return new VirtualServer(new WorkerInstance(s[0], Integer.parseInt(s[1]), 
Integer.parseInt(s[2]),
-        Integer.parseInt(s[3]), Integer.parseInt(s[4])), 0);
+    return new VirtualServer(new WorkerInstance(matcher.group("host"), 
Integer.parseInt(matcher.group("port")),
+        Integer.parseInt(matcher.group("grpc")), 
Integer.parseInt(matcher.group("service")),
+        Integer.parseInt(matcher.group("mailbox"))), 
Integer.parseInt(matcher.group("virtualid")));
   }
 
   public static String instanceToString(VirtualServer serverInstance) {
-    return StringUtils.join(serverInstance.getHostname(), '_', 
serverInstance.getPort(), '_',
-        serverInstance.getGrpcPort(), '_', 
serverInstance.getQueryServicePort(), '_',
+    return String.format("%s@%s:%s(%s:%s:%s)", serverInstance.getVirtualId(), 
serverInstance.getHostname(),
+        serverInstance.getPort(), serverInstance.getGrpcPort(), 
serverInstance.getQueryServicePort(),
         serverInstance.getQueryMailboxPort());

Review Comment:
   same here to mark as deprecate. 



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