jackjlli commented on a change in pull request #4865: Misc clean up for
PinotHelixResourceManager
URL: https://github.com/apache/incubator-pinot/pull/4865#discussion_r351460201
##########
File path:
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -394,44 +387,40 @@ public synchronized PinotResourceManagerResponse
addInstance(@Nonnull Instance i
}
/**
- * Get all Pinot realtime table names.
+ * Get all offline table names.
*
- * @return List of Pinot realtime table names
+ * @return List of offline table names
*/
- @Nonnull
- public List<String> getAllRealtimeTables() {
- List<String> resourceNames = getAllResources();
- Iterator<String> iterator = resourceNames.iterator();
- while (iterator.hasNext()) {
- if (!TableNameBuilder.REALTIME.tableHasTypeSuffix(iterator.next())) {
- iterator.remove();
+ public List<String> getAllOfflineTables() {
+ List<String> offlineTableNames = new ArrayList<>();
+ for (String resourceName : getAllResources()) {
+ if (TableNameBuilder.OFFLINE.tableHasTypeSuffix(resourceName)) {
+ offlineTableNames.add(resourceName);
}
}
- return resourceNames;
+ return offlineTableNames;
}
/**
- * Get all Pinot offline table names
- * @return List of Pinot realtime table names
+ * Get all realtime table names.
+ *
+ * @return List of realtime table names
*/
- @Nonnull
- public List<String> getAllOfflineTables() {
- List<String> resourceNames = getAllResources();
- Iterator<String> iterator = resourceNames.iterator();
- while (iterator.hasNext()) {
- if (!TableNameBuilder.OFFLINE.tableHasTypeSuffix(iterator.next())) {
- iterator.remove();
+ public List<String> getAllRealtimeTables() {
+ List<String> realtimeTableNames = new ArrayList<>();
+ for (String resourceName : getAllResources()) {
+ if (TableNameBuilder.REALTIME.tableHasTypeSuffix(resourceName)) {
Review comment:
Same here. `TableNameBuilder.isRealtimeTableResource(resourceName)` might be
better.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]