zhtaoxiang commented on code in PR #12804:
URL: https://github.com/apache/pinot/pull/12804#discussion_r1554424164
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -831,14 +815,9 @@ public List<String> getAllRawTables() {
* @return List of raw table names in provided database name
*/
public List<String> getAllRawTables(@Nullable String databaseName) {
- Set<String> rawTableNames = new HashSet<>();
- for (String resourceName : getAllResources()) {
- if (TableNameBuilder.isTableResource(resourceName)
- && DatabaseUtils.isPartOfDatabase(resourceName, databaseName)) {
- rawTableNames.add(TableNameBuilder.extractRawTableName(resourceName));
- }
- }
- return new ArrayList<>(rawTableNames);
+ return getAllResources().stream().filter(
+ resourceName -> TableNameBuilder.isTableResource(resourceName) &&
DatabaseUtils.isPartOfDatabase(resourceName,
+
databaseName)).map(TableNameBuilder::extractRawTableName).distinct().collect(Collectors.toList());
Review Comment:
nit: could you please help me understand why we need to call `distinct()`?
--
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]