anishmehta24 opened a new pull request, #1715: URL: https://github.com/apache/arrow-go/pull/1715
### Rationale for this change `GetFieldReaders` only reads the selected leaves, but the types it returns still list the unselected ones when they sit under a nested struct or a list. Selecting `s.inner.x` and `l.list.element.x` from `s: struct<a, inner: struct<x, y>>` and `l: list<struct<x, y>>` gives `s: struct<inner: struct<x, y>>` and `l: list<struct<x, y>>`. The list arrays in the record batches also fail `ValidateFull`, because their values are `struct<x>`. ### What changes are included in this PR? The struct reader now builds its type from each child reader's field instead of the original child field, so pruning carries through nested structs. List, large list and fixed size list readers take their element type from the child reader. The C++ reader does the same in `GetReader`. ### Are these changes tested? Yes. `TestGetFieldReadersPrunesNestedFields` selects one nested leaf under a struct, a list, a large list and a fixed size list, with `Parallel` off and on. It checks the schema from `GetFieldReaders`, the column types from `GetRecordReader`, and runs `ValidateRecordFull` on the batch. It fails on main. ```sh cd parquet && go test -tags assert ./pqarrow/ ./file/ cd parquet && go test -tags assert,noasm ./pqarrow/ ./file/ cd parquet && golangci-lint run ./pqarrow/... ``` ### Are there any user-facing changes? Yes. When only part of a nested struct is selected, the schema and arrays from `GetFieldReaders`, `GetRecordReader` and `ReadRowGroups` no longer include the unselected fields. Fixes #1711. -- 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]
