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


##########
api/src/main/java/org/apache/iceberg/metrics/MetricsContext.java:
##########
@@ -126,15 +126,14 @@ public Timer timer(String name, TimeUnit unit) {
 
       @Override
       public <T extends Number> Counter<T> counter(String name, Class<T> type, 
Unit unit) {
-        return new Counter<T>() {
-          @Override
-          public void increment() {
-          }
-
-          @Override
-          public void increment(T amount) {
-          }
-        };
+        if (Integer.class.equals(type)) {
+          return (Counter<T>) IntCounter.NOOP;
+        }
+
+        if (Long.class.equals(type)) {
+          return (Counter<T>) LongCounter.NOOP;
+        }
+        throw new IllegalArgumentException(String.format("Counter for type %s 
is not supported", type.getName()));

Review Comment:
   fixed



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