1fanwang opened a new pull request, #10811:
URL: https://github.com/apache/arrow-rs/pull/10811

   # Which issue does this PR close?
   
   - Closes #6700.
   
   # Rationale for this change
   
   Converting an Arrow schema to integration JSON and reading it back silently 
drops metadata attached to fields. The emitted field metadata is `null` instead 
of the original key-value map.
   
   # What changes are included in this PR?
   
   `field_to_json` now adds non-empty metadata after constructing either an 
ordinary or dictionary field. Fields without metadata keep their existing JSON 
shape.
   
   # Are these changes tested?
   
   Yes. Ordinary and dictionary field metadata tests fail on `origin/main` and 
pass with this change. The full crate suite also passes.
   
   <details>
   <summary>Raw logs</summary>
   
   Before (`origin/main` at `cd7c6b83abd6605a83014b3d043930a592542510`):
   
   ```console
   $ cargo test -p arrow-integration-test schema::tests::field_metadata_json -- 
--exact
   test schema::tests::field_metadata_json ... FAILED
   left: Null
   right: Object {"key": String("value")}
   test result: FAILED. 0 passed; 1 failed
   
   $ cargo test -p arrow-integration-test 
schema::tests::dictionary_field_metadata_json -- --exact
   test schema::tests::dictionary_field_metadata_json ... FAILED
   left: Null
   right: Object {"dictionary_key": String("dictionary_value")}
   test result: FAILED. 0 passed; 1 failed
   ```
   
   After:
   
   ```console
   $ cargo test -p arrow-integration-test schema::tests::field_metadata_json -- 
--exact
   test schema::tests::field_metadata_json ... ok
   test result: ok. 1 passed; 0 failed
   
   $ cargo test -p arrow-integration-test 
schema::tests::dictionary_field_metadata_json -- --exact
   test schema::tests::dictionary_field_metadata_json ... ok
   test result: ok. 1 passed; 0 failed
   
   $ cargo test -p arrow-integration-test
   test result: ok. 13 passed; 0 failed
   ```
   
   </details>
   
   Hygiene: `cargo fmt --check` and `cargo clippy -p arrow-integration-test 
--all-targets --all-features -- -D warnings` pass.
   
   # Are there any user-facing changes?
   
   Yes. Integration JSON now preserves non-empty metadata on ordinary and 
dictionary fields. There is no public API or breaking change.
   


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