jtao15 commented on code in PR #8784:
URL: https://github.com/apache/pinot/pull/8784#discussion_r883179897


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java:
##########
@@ -589,20 +589,19 @@ public Response startReplaceSegments(
       @ApiParam(value = "Force cleanup") @QueryParam("forceCleanup") 
@DefaultValue("false") boolean forceCleanup,
       @ApiParam(value = "Fields belonging to start replace segment request", 
required = true)
           StartReplaceSegmentsRequest startReplaceSegmentsRequest) {
+    TableType tableType = Constants.validateTableType(tableTypeStr);
+    if (tableType == null) {
+      throw new ControllerApplicationException(LOGGER, "Table type should 
either be offline or realtime",
+          Response.Status.BAD_REQUEST);
+    }
+    String tableNameWithType =
+        
ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager, 
tableName, tableType, LOGGER).get(0);
     try {
-      TableType tableType = Constants.validateTableType(tableTypeStr);
-      if (tableType == null) {
-        throw new ControllerApplicationException(LOGGER, "Table type should 
either be offline or realtime",
-            Response.Status.BAD_REQUEST);
-      }
-      String tableNameWithType =
-          
ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager, 
tableName, tableType, LOGGER).get(0);
       String segmentLineageEntryId = 
_pinotHelixResourceManager.startReplaceSegments(tableNameWithType,
           startReplaceSegmentsRequest.getSegmentsFrom(), 
startReplaceSegmentsRequest.getSegmentsTo(), forceCleanup);
       return 
Response.ok(JsonUtils.newObjectNode().put("segmentLineageEntryId", 
segmentLineageEntryId)).build();
-    } catch (WebApplicationException wae) {

Review Comment:
   I think we have it before because we throw `ControllerApplicationException` 
inside the try block when input table/type is invalid. After moving it out, we 
will not get `ControllerApplicationException` in the try block, so we don't 
need to keep it as before?



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