ZhongxuanWang opened a new pull request, #12345: URL: https://github.com/apache/arrow-rs/pull/12345
# Which issue does this PR close? - Closes #12343. # Rationale for this change `parquet` lists `chrono` as a required dependency, so even a build with `default-features = false` and without the `arrow` feature links it, and `cargo audit` / `cargo deny` report RUSTSEC-2026-0543 for every crate that depends on `parquet`. `parquet`'s own use of `chrono` is three display helpers in `record::api`, which need no more than integer arithmetic. # What changes are included in this PR? - `convert_date_to_string`, `convert_timestamp_millis_to_string` and `convert_timestamp_micros_to_string` convert days since the epoch to a civil date with Howard Hinnant's `civil_from_days` (floor division, so values before 1970 are right) and format the fields directly. The output matches chrono's `%Y-%m-%d`, `%Y-%m-%d %H:%M:%S%.3f %:z` and `%Y-%m-%d %H:%M:%S%.6f %:z` for every value chrono accepts, including chrono's `%Y` rule of a sign before years outside 0..=9999 (`-0001`, `+10000`). - `chrono` moves from `[dependencies]` to `[dev-dependencies]`, where the unit tests, the `arrow_reader` integration tests and the `write_parquet` example still use it. - The doc comment on `convert_date_to_string` said the date is displayed in the local timezone; it is UTC. With the `arrow` feature (on by default) `chrono` still comes in through `arrow-array`; that is #9183 and out of scope here. With `--no-default-features`, `cargo tree -p parquet -e normal` no longer lists `chrono`, and with the default features it lists it only under `arrow-array`. # Are these changes tested? Yes. The existing `test_convert_date_to_string`, `test_convert_timestamp_millis_to_string` and `test_convert_timestamp_micros_to_string` tests pin the common case. A new test, `test_convert_date_and_timestamp_to_string_extreme_years`, compares all three helpers with chrono at year 0 (including 0000-02-29), negative years, year 10000, the epoch, the last microsecond before it, and chrono's `NaiveDate::MIN` and `MAX`. Outside this PR, the new helpers were also compared with chrono 0.4.45 (the version in `Cargo.lock`) in a throwaway program: every one of the 191,491,529 days chrono accepts, 400 million random millisecond and microsecond timestamps across chrono's range and near the epoch, and 40,006 timestamps around the ends of chrono's range and the epoch. All matched byte for byte. `cargo test -p parquet` passes with the default features and with `--all-features`. # Are there any significant user-facing changes? No public API changes. One behaviour change: a DATE, TIMESTAMP_MILLIS or TIMESTAMP_MICROS value outside chrono's range (more than about 262,000 years from year 0) used to panic in `Field`'s `Display` and `to_json_value`, through chrono's `unwrap`. It now formats on the same proleptic Gregorian calendar, for example `i64::MAX` milliseconds as `+292278994-08-17 07:12:55.807 +00:00`. # AI usage disclosure The code and tests in this PR were written with Claude Code (an AI assistant). They were verified by the test runs listed in "Are these changes tested?". 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
