You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Python] parquet.read_table nested fields in columns does not work for use_legacy_dataset=False #30143
Joris Van den Bossche / @jorisvandenbossche: [~TomScheffers] that's indeed a current limitation of the new implementation. There is work underway to enable this (the basic feature was just merged for C++ (ARROW-13987), now it still has to be exposed in python (ARROW-11259)), and hopefully this will be possible in the next version 7.0.0
First was the result of using pq.read_table with legacy implementation vs using ds.dataset with column projection. The data can get selected correctly with the dataset implementation but what happens is that the structure of a nested field is not kept (from struct it is flattened to string column). In case of using columns selection with a list in {}ds.dataset{}, it errors, as reported in the issue.
When Scanner object is being created from the dataset class via to_table and (through _populate_builder) and in the case of a list of columns the ProjectColumns method ("arrow::dataset::ScannerBuilder") is being called it only accepts string column names and errors when a column is a struct.
We were thinking if it would be a good idea to add a new method in scanner.cc that would mimic FromNames method but takes field_ref as an argument? Afterwords there would also be a need to recreate a struct field for which we are not sure how to approach.
Closing as fixed. Selecting nested struct fields via columns=['properties.country'] in pq.read_table() has worked with the dataset-based reader since #14326 landed in pyarrow 10.0.0, and use_legacy_dataset has since been removed. Referring to a field inside a list of structs still fails on pyarrow 26.0.1, and that is tracked in #32794.
Activity
asfimport commentedon Nov 9, 2021
Joris Van den Bossche / @jorisvandenbossche:
[~TomScheffers]that's indeed a current limitation of the new implementation. There is work underway to enable this (the basic feature was just merged for C++ (ARROW-13987), now it still has to be exposed in python (ARROW-11259)), and hopefully this will be possible in the next version 7.0.0asfimport commentedon Apr 21, 2022
Krisztian Szucs / @kszucs:
Postponing to 9.0
asfimport commentedon Apr 22, 2022
Alenka Frim / @AlenkaF:
I would like to add observations we got today when pairing with @jorisvandenbossche on this topic.
First was the result of using
pq.read_tablewith legacy implementation vs usingds.datasetwith column projection. The data can get selected correctly with the dataset implementation but what happens is that the structure of a nested field is not kept (from struct it is flattened to string column). In case of using columns selection with a list in{}ds.dataset{}, it errors, as reported in the issue.When Scanner object is being created from the dataset class via
to_tableand (through _populate_builder) and in the case of a list of columns theProjectColumnsmethod ("arrow::dataset::ScannerBuilder") is being called it only accepts string column names and errors when a column is a struct.We were thinking if it would be a good idea to add a new method in
scanner.ccthat would mimicFromNamesmethod but takesfield_refas an argument? Afterwords there would also be a need to recreate a struct field for which we are not sure how to approach.cc @westonpace @pitrou do you think that would be a correct way to go?
igozali commentedon Oct 10, 2023
Any updates for fixing this issue by any chance?
thisisnic commentedon Nov 7, 2026
Closing as fixed. Selecting nested struct fields via
columns=['properties.country']inpq.read_table()has worked with the dataset-based reader since #14326 landed in pyarrow 10.0.0, anduse_legacy_datasethas since been removed. Referring to a field inside a list of structs still fails on pyarrow 26.0.1, and that is tracked in #32794.