yuanbenson commented on code in PR #9295:
URL: https://github.com/apache/pinot/pull/9295#discussion_r959048943
##########
pinot-common/src/main/java/org/apache/pinot/common/utils/FileUploadDownloadClient.java:
##########
@@ -747,6 +751,54 @@ public SimpleHttpResponse uploadSegment(URI uri, String
segmentName, InputStream
return uploadSegment(uri, segmentName, inputStream, null, parameters,
HttpClient.DEFAULT_SOCKET_TIMEOUT_MS);
}
+ /**
+ * Returns a map from a given tableType to a list of segments for that given
tableType (OFFLINE or REALTIME)
+ * If tableType is left unspecified, both OFFLINE and REALTIME segments will
be returned in the map.
+ */
+ public Map<String, List<String>> getSegments(URI uri, String rawTableName,
@Nullable String tableType,
+ boolean excludeReplacedSegments)
+ throws URISyntaxException, IOException {
+ List<String> tableTypes;
+ if (tableType == null || tableType.isEmpty()) {
+ tableTypes = Arrays.asList(TableType.OFFLINE.toString(),
TableType.REALTIME.toString());
+ } else {
+ tableTypes = Arrays.asList(tableType);
Review Comment:
Refactored the code to take in `tableType` as `TableType` rather than
`String`. That should prevent illegal table types.
##########
pinot-common/src/main/java/org/apache/pinot/common/utils/FileUploadDownloadClient.java:
##########
@@ -747,6 +751,54 @@ public SimpleHttpResponse uploadSegment(URI uri, String
segmentName, InputStream
return uploadSegment(uri, segmentName, inputStream, null, parameters,
HttpClient.DEFAULT_SOCKET_TIMEOUT_MS);
}
+ /**
+ * Returns a map from a given tableType to a list of segments for that given
tableType (OFFLINE or REALTIME)
+ * If tableType is left unspecified, both OFFLINE and REALTIME segments will
be returned in the map.
+ */
+ public Map<String, List<String>> getSegments(URI uri, String rawTableName,
@Nullable String tableType,
+ boolean excludeReplacedSegments)
+ throws URISyntaxException, IOException {
+ List<String> tableTypes;
+ if (tableType == null || tableType.isEmpty()) {
+ tableTypes = Arrays.asList(TableType.OFFLINE.toString(),
TableType.REALTIME.toString());
+ } else {
+ tableTypes = Arrays.asList(tableType);
Review Comment:
Refactored the code to take in `tableType` as `TableType` rather than
`String`. That should prevent illegal table types, thanks.
--
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]