thisisnic commented on issue #31678:
URL: https://github.com/apache/arrow/issues/31678#issuecomment-6933316392

   This still reproduces on main. `write_to_dataset()` with `partition_cols` 
doesn't write the partition columns into the files, so the collected metadata 
doesn't match the `table.schema` passed to `write_metadata()`.
   
   Workaround is to drop the partition columns from the schema when writing 
`_metadata`:
   
   ```python
   file_schema = 
table.schema.remove(table.schema.get_field_index("partition_col"))
   pq.write_metadata(file_schema, root_path / "_metadata", 
metadata_collector=metadata_collector)
   ```
   
   The docs only show the unpartitioned case; #28950 was meant to fix that but 
was closed without a docs update, so let's use this issue to add a partitioned 
example.
   


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

Reply via email to