manuzhang opened a new pull request, #12117: URL: https://github.com/apache/arrow-rs/pull/12117
# Which issue does this PR close? Relates to apache/datafusion-comet#6246. # Rationale for this change Applications that adapt cached Parquet metadata need to replace file-level key/value entries, for example an Arrow schema hint, before constructing a reader. The existing public constructors require rebuilding `FileMetaData` and `ParquetMetaData` to make this change. That loses private encryption metadata and the file decryptor, so this approach cannot safely handle encrypted files. A setter on the existing metadata builder lets callers update those entries while preserving the state required to read the file. A downstream use is Comet's per-file schema adaptation, which currently has to exclude encrypted files from its metadata rewrite. # What changes are included in this PR? Add `ParquetMetaDataBuilder::set_key_value_metadata(Option<Vec<KeyValue>>)`. It replaces the complete list, with `None` removing the entries. `Arc::make_mut` gives shared file metadata copy-on-write behavior and preserves the other file metadata, row groups, page indexes and decryptor. The update affects only in-memory metadata. # Are these changes tested? A unit test covers adding, replacing and removing entries, including an explicitly empty list. It checks that cached metadata remains unchanged, the other file metadata (including encryption fields when enabled) is preserved, and row groups and page indexes remain shared. An encrypted-read regression covers encrypted and plaintext footers. It updates already-loaded metadata, verifies its page indexes, and reads the encrypted data without supplying decryption keys again. This checks that the cached decryptor survives the update. # Are there any significant user-facing changes? This is an additive public API. Existing method signatures and behavior are unchanged. AI assistance: Codex drafted the implementation and regression tests and ran local validation. -- 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]
