nastra commented on code in PR #5427:
URL: https://github.com/apache/iceberg/pull/5427#discussion_r947116886


##########
api/src/main/java/org/apache/iceberg/metrics/ScanReport.java:
##########
@@ -102,87 +113,364 @@ public Builder withSnapshotId(long newSnapshotId) {
       return this;
     }
 
-    public Builder withFilter(Expression newFilter) {
-      this.filter = newFilter;
-      return this;
-    }
-
     public Builder withProjection(Schema newProjection) {
       this.projection = newProjection;
       return this;
     }
 
     public Builder fromScanMetrics(ScanMetrics newScanMetrics) {
-      this.scanMetrics = newScanMetrics;
+      this.scanMetrics = ScanMetricsResult.fromScanMetrics(newScanMetrics);
+      return this;
+    }
+
+    public Builder fromScanMetricsResult(ScanMetricsResult 
newScanMetricsResult) {
+      this.scanMetrics = newScanMetricsResult;
       return this;
     }
 
     public ScanReport build() {
       Preconditions.checkArgument(null != tableName, "Invalid table name: 
null");
-      Preconditions.checkArgument(null != filter, "Invalid expression filter: 
null");
       Preconditions.checkArgument(null != projection, "Invalid schema 
projection: null");
       Preconditions.checkArgument(null != scanMetrics, "Invalid scan metrics: 
null");
-      return new ScanReport(tableName, snapshotId, filter, projection, 
scanMetrics);
+      return new ScanReport(tableName, snapshotId, projection, scanMetrics);
+    }
+  }
+
+  /** A serializable version of a {@link Timer} that carries its result. */
+  public static class TimerResult {
+    private final String name;
+    private final TimeUnit timeUnit;
+    private final Duration totalDuration;
+    private final long count;
+
+    static TimerResult fromTimer(Timer timer) {
+      Preconditions.checkArgument(null != timer, "Invalid timer: null");
+      if (Timer.NOOP.equals(timer)) {
+        return null;
+      }
+      return new TimerResult(timer.name(), timer.unit(), 
timer.totalDuration(), timer.count());
+    }
+
+    TimerResult(String name, TimeUnit timeUnit, Duration totalDuration, long 
count) {
+      Preconditions.checkArgument(null != name, "Invalid timer name: null");
+      Preconditions.checkArgument(null != timeUnit, "Invalid time unit: null");
+      Preconditions.checkArgument(null != totalDuration, "Invalid duration: 
null");
+      this.name = name;
+      this.timeUnit = timeUnit;
+      this.totalDuration = totalDuration;
+      this.count = count;
+    }
+
+    public String name() {
+      return name;
+    }
+
+    public TimeUnit timeUnit() {
+      return timeUnit;
+    }
+
+    public Duration totalDuration() {
+      return totalDuration;
+    }
+
+    public long count() {
+      return count;
+    }
+
+    @Override
+    public String toString() {
+      return MoreObjects.toStringHelper(name())
+          .add("duration", totalDuration())
+          .add("count", count)
+          .add("timeUnit", timeUnit)
+          .toString();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) {
+        return true;
+      }
+
+      if (o == null || getClass() != o.getClass()) {
+        return false;
+      }
+
+      TimerResult that = (TimerResult) o;
+      return count == that.count
+          && Objects.equal(name, that.name)
+          && timeUnit == that.timeUnit
+          && Objects.equal(totalDuration, that.totalDuration);
+    }
+
+    @Override
+    public int hashCode() {
+      return Objects.hashCode(name, timeUnit, totalDuration, count);
+    }
+  }
+
+  /** A serializable version of a {@link Counter} that carries its result. */
+  public static class CounterResult {
+    private final String name;
+    private final MetricsContext.Unit unit;
+    private final long value;
+
+    static CounterResult fromCounter(Counter<Long> counter) {
+      Preconditions.checkArgument(null != counter, "Invalid counter: null");
+      if (LongCounter.NOOP.equals(counter)) {

Review Comment:
   Sorry for the troubles, this was unfortunately caused by a silent merge 
conflict. Build was fixed by https://github.com/apache/iceberg/pull/5506 and 
just merged a few minutes ago. 



-- 
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]

Reply via email to