jtao15 commented on a change in pull request #6975:
URL: https://github.com/apache/incubator-pinot/pull/6975#discussion_r641842651



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/utils/FileUploadDownloadClient.java
##########
@@ -296,6 +309,21 @@ public static URI getUploadSegmentURI(URI controllerURI)
     return getURI(controllerURI.getScheme(), controllerURI.getHost(), 
controllerURI.getPort(), SEGMENT_PATH);
   }
 
+  public static URI getStartReplaceSegmentsURI(URI controllerURI, String 
rawTableName, String tableType)
+      throws URISyntaxException {
+    return getURI(controllerURI.getScheme(), controllerURI.getHost(), 
controllerURI.getPort(),

Review comment:
       Yes, the original `getUri()` will not work since 
`segments/mytable/startReplaceSegments?type=OFFLINE` is passed as `path`
   ```
   private static URI getURI(String protocol, String host, int port, String 
path)      
       throws URISyntaxException {    
     if (!SUPPORTED_PROTOCOLS.contains(protocol)) {      
       throw new IllegalArgumentException(String.format("Unsupported protocol 
'%s'", protocol));    
     }    
     return new URI(protocol, null, host, port, path, null, null);  
   }
   ```
   So I added the new function `getURI()` which will pass 
`segments/mytable/startReplaceSegments` as `path`, and `type=OFFLINE` as 
`query`.
   ```
   private static URI getURI(String protocol, String host, int port, String 
path, String query)      
       throws URISyntaxException {    
     if (!SUPPORTED_PROTOCOLS.contains(protocol)) {      
       throw new IllegalArgumentException(String.format("Unsupported protocol 
'%s'", protocol));    
     }    
     return new URI(protocol, null, host, port, path, query, null);  
   }
   ```
   I tried on local, it will return the correct uri.




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

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

Reply via email to