Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
Assume you open a dataset and want to write it back with some projected columns. Currently you need to actually materialize it to a Table or convert it to an iterator of batches, for being able to write the dataset:
import pyarrow.dataset as ds dataset = ds.dataset(pa.table({'a': [1, 2, 3]})) # write with projected columns projection = {'b': ds.field('a')} # this works but materializes full table ds.write_dataset(dataset.to_table(columns=projection), "test.parquet", format="parquet") # this requires the exact schema, which is a bit annoying as you need to construct that manually ds.write_dataset(dataset.to_batches(columns=projection), "test.parquet", format="parquet", schema=...<projected schema>...)
You could expect to do the following?
ds.write_dataset(dataset.scanner(columns=projection), "test.parquet", format="parquet")
cc lidavidm do you think this logic is correct?
(encountered this while trying to reproduce ARROW-12620 in Python)
Attachments
Issue Links
- is related to
-
ARROW-12647 [Python][Dataset] Consider allowing projecting/scanning with a given schema
- Open
- links to