diff --git a/client-core/src/main/java/com/influxdb/query/internal/FluxCsvParser.java b/client-core/src/main/java/com/influxdb/query/internal/FluxCsvParser.java index d41bb3d27b5..db4633c4d68 100644 --- a/client-core/src/main/java/com/influxdb/query/internal/FluxCsvParser.java +++ b/client-core/src/main/java/com/influxdb/query/internal/FluxCsvParser.java @@ -33,6 +33,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -404,11 +405,13 @@ private void addColumnNamesAndTags(@Nonnull final FluxTable table, @Nonnull fina fluxColumn.setLabel(columnName); } - HashSet seen = new HashSet<>(); - columnNames.removeIf(seen::add); + Set items = new HashSet<>(); + Set duplicates = columnNames.stream() + .filter(n -> !items.add(n)) + .collect(Collectors.toSet()); - if (!columnNames.isEmpty()) { - System.out.printf("The response contains columns with duplicated names: %s)%n", columnNames); + if (!duplicates.isEmpty()) { + System.out.printf("The response contains columns with duplicated names: %s)%n", duplicates); System.out.println("You should use the \"FluxRecord.getRow()\" to access your data instead of " + "\"FluxRecord.getValues()\"."); }