szehon-ho commented on code in PR #5376:
URL: https://github.com/apache/iceberg/pull/5376#discussion_r954089250


##########
core/src/main/java/org/apache/iceberg/BaseFilesTable.java:
##########
@@ -186,4 +201,43 @@ ManifestFile manifest() {
       return manifest;
     }
   }
+
+  static class ContentFileStructWithMetrics implements StructLike {
+    private final Schema projectedFilesSchema;
+    private final StructLike fileAsStruct;
+    private final Map<String, StructLike> readableMetrics;
+
+    ContentFileStructWithMetrics(
+        Schema projectedFileSchema,
+        StructLike fileAsStruct,
+        Map<String, StructLike> readableMetrics) {
+      this.projectedFilesSchema = projectedFileSchema;
+      this.fileAsStruct = fileAsStruct;
+      this.readableMetrics = readableMetrics;
+    }
+
+    @Override
+    public int size() {
+      return projectedFilesSchema.columns().size() + 1;
+    }
+
+    @Override
+    public <T> T get(int pos, Class<T> javaClass) {
+      if (pos < projectedFilesSchema.columns().size()) {
+        return fileAsStruct.get(pos, javaClass);
+      } else if (pos == projectedFilesSchema.columns().size()) {
+        return javaClass.cast(readableMetrics);
+      } else {
+        throw new IllegalArgumentException(
+            String.format(
+                "Illegal position access for FileRow: %d, max allowed is %d",
+                pos, fileAsStruct.size()));
+      }
+    }
+
+    @Override
+    public <T> void set(int pos, T value) {
+      throw new UnsupportedOperationException("FileEntryRow is read only");

Review Comment:
   Sorry, earlier version of name of this class



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