RussellSpitzer commented on a change in pull request #1744:
URL: https://github.com/apache/iceberg/pull/1744#discussion_r521718519



##########
File path: core/src/main/java/org/apache/iceberg/avro/PruneColumns.java
##########
@@ -95,7 +95,7 @@ public Schema record(Schema record, List<String> names, 
List<Schema> fields) {
 
     if (hasChange) {
       return copyRecord(record, filteredFields);
-    } else if (filteredFields.size() == record.getFields().size()) {
+    } else if (record.getFields().size() != 0 && filteredFields.size() == 
record.getFields().size()) {

Review comment:
       This line is the change to fix bug 2,
   
   **Example of Bug 2**
   ```
   From (A, B, C, D {foo, bar, baz {}} ) // Starting with D containing a field 
baz which is empty
   Project (A)
   Returns
   (A, D{ baz {} }) // Includes D even though it was not requested
   ```
   
   The issue being that a struct which contains no elements naturally will 
always be included because
   `records.filedsize == 0 == filteredFields.size == 0`
   
   I think that behavior is incorrect, and this should be pruned out if it 
isn't needed in the projection




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

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