ctubbsii commented on code in PR #2638:
URL: https://github.com/apache/accumulo/pull/2638#discussion_r853006495
##########
test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionMetricsIT.java:
##########
@@ -166,7 +166,7 @@ public void testMetrics() throws Exception {
UtilWaitThread.sleep(100);
try (TabletsMetadata tm =
getCluster().getServerContext().getAmple().readTablets()
.forLevel(DataLevel.USER).fetch(ColumnType.ECOMP).build()) {
- count = tm.stream().flatMap(t ->
t.getExternalCompactions().keySet().stream()).count();
+ count = tm.stream().mapToLong(t ->
t.getExternalCompactions().keySet().size()).sum();
Review Comment:
The output of the user function that you pass to flatMap should be a Stream.
So, you're converting the original stream into a stream of streams. flatMap
then just concatenates them, so all the elements of each of those streams are
put into one output stream.
These should be identical. Essentially, it goes from `sizeof(concat(set1,
set2, ... setN))` to `sum(sizeof(set1), sizeof(set2), ... sizeof(setN))`.
--
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]