kevinjqliu commented on code in PR #1443: URL: https://github.com/apache/iceberg-python/pull/1443#discussion_r1902352957
########## pyiceberg/io/pyarrow.py: ########## @@ -1286,14 +1310,20 @@ def _task_to_record_batches( continue output_batches = arrow_table.to_batches() for output_batch in output_batches: - yield _to_requested_schema( + result_batch = _to_requested_schema( projected_schema, file_project_schema, output_batch, downcast_ns_timestamp_to_us=True, use_large_types=use_large_types, ) + # Inject projected column values if available + for name, value in projected_missing_fields.items(): + result_batch = result_batch.set_column(result_batch.schema.get_field_index(name), name, [value]) Review Comment: > Is there a chance that a column might exist in the data but not in the file schema? i dont think parquet allows that. i guess `projected_field_ids.difference(file_project_schema.field_ids)` in a good enough invariant to ensure we dont overwrite. i would prefer we wrap the whole loop with something like `should_project_columns` -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org