dramaticlly commented on code in PR #7539:
URL: https://github.com/apache/iceberg/pull/7539#discussion_r1191714292


##########
core/src/main/java/org/apache/iceberg/BaseEntriesTable.java:
##########
@@ -125,31 +130,128 @@ ManifestFile manifest() {
 
     @Override
     public CloseableIterable<StructLike> rows() {
+      Types.NestedField readableMetricsField = 
projection.findField(MetricsUtil.READABLE_METRICS);
       // Project data-file fields
       CloseableIterable<StructLike> prunedRows;
-      if (manifest.content() == ManifestContent.DATA) {
-        prunedRows =
-            CloseableIterable.transform(
-                ManifestFiles.read(manifest, io).project(fileSchema).entries(),
-                file -> (GenericManifestEntry<DataFile>) file);
+      if (readableMetricsField == null) {
+        if (manifest.content() == ManifestContent.DATA) {
+          prunedRows =
+              CloseableIterable.transform(
+                  ManifestFiles.read(manifest, io, 
specsById).project(fileSchema).entries(),
+                  entry -> (GenericManifestEntry<DataFile>) entry);
+        } else {
+          prunedRows =
+              CloseableIterable.transform(
+                  ManifestFiles.readDeleteManifest(manifest, io, specsById)
+                      .project(fileSchema)
+                      .entries(),
+                  entry -> (GenericManifestEntry<DeleteFile>) entry);
+        }
+
+        // Project non-readable fields
+        Schema readSchema = 
ManifestEntry.wrapFileSchema(fileSchema.asStruct());

Review Comment:
   yep, definitely



##########
core/src/main/java/org/apache/iceberg/BaseEntriesTable.java:
##########
@@ -125,31 +130,128 @@ ManifestFile manifest() {
 
     @Override
     public CloseableIterable<StructLike> rows() {
+      Types.NestedField readableMetricsField = 
projection.findField(MetricsUtil.READABLE_METRICS);
       // Project data-file fields
       CloseableIterable<StructLike> prunedRows;
-      if (manifest.content() == ManifestContent.DATA) {
-        prunedRows =
-            CloseableIterable.transform(
-                ManifestFiles.read(manifest, io).project(fileSchema).entries(),
-                file -> (GenericManifestEntry<DataFile>) file);
+      if (readableMetricsField == null) {
+        if (manifest.content() == ManifestContent.DATA) {

Review Comment:
   yeah make sense! Also realized from other PR that this can be simplified 
further with 
   
   `ManifestFiles.open(manifest, io, specsById)` so it's agnostic read to data 
and delete manifests



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