aokolnychyi commented on code in PR #6919:
URL: https://github.com/apache/iceberg/pull/6919#discussion_r1144220332
##########
core/src/main/java/org/apache/iceberg/TableScanContext.java:
##########
@@ -351,14 +352,15 @@ TableScanContext planWith(ExecutorService executor) {
toSnapshotId,
executor,
fromSnapshotInclusive,
- metricsReporter);
+ metricsReporters);
}
- MetricsReporter metricsReporter() {
- return metricsReporter;
+ Collection<MetricsReporter> metricsReporter() {
+ return metricsReporters;
}
TableScanContext reportWith(MetricsReporter reporter) {
+ metricsReporter().add(reporter);
Review Comment:
If I remember correctly, this class is immutable and we create a new
instance on every call. We should probably follow what is done for updating
properties in `withOption`, where we copy existing options into a new list
before adding.
```
TableScanContext reportWith(MetricsReporter reporter) {
ImmutableList.Builder<MetricsReporter> builder = ImmutableList.builder();
builder.addAll(metricsReporters);
builder.add(reporter);
List<MetricsReporter> newMetricsReporters = builder.build();
return new TableScanContext(
snapshotId,
rowFilter,
ignoreResiduals,
caseSensitive,
colStats,
projectedSchema,
selectedColumns,
options,
fromSnapshotId,
toSnapshotId,
planExecutor,
fromSnapshotInclusive,
newMetricsReporters);
}
```
--
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]