You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "nastra (via GitHub)" <gi...@apache.org> on 2023/03/20 09:37:38 UTC

[GitHub] [iceberg] nastra commented on a diff in pull request #7145: Core: Use unknown report type for forward-compatibility

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


##########
core/src/main/java/org/apache/iceberg/rest/requests/ReportMetricsRequest.java:
##########
@@ -54,16 +55,20 @@ default void validate() {
   }
 
   static ReportMetricsRequest of(MetricsReport report) {
-    ReportType reportType = null;
+    ReportType reportType = ReportType.UNKNOWN;
     if (report instanceof ScanReport) {
       reportType = ReportType.SCAN_REPORT;
     } else if (report instanceof CommitReport) {
       reportType = ReportType.COMMIT_REPORT;
     }
 
-    Preconditions.checkArgument(
-        null != reportType, "Unsupported report type: %s", report.getClass().getName());
-
     return ImmutableReportMetricsRequest.builder().reportType(reportType).report(report).build();

Review Comment:
   we don't fallback to returning `ReportMetricsRequest unknown()` because should prefer the `report` that was passed in to this method in L57



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org