alamb opened a new issue, #7533:
URL: https://github.com/apache/arrow-rs/issues/7533
**Describe the bug**
Panic in `pretty_format` function when displaying DurationSecondsArray with
`i64::MIN` / `i64::MAX`
**To Reproduce**
```rust
use std::sync::Arc;
use arrow::array::{ArrayRef, DurationSecondArray};
use arrow::util::pretty::pretty_format_columns;
fn main() {
// The following code panics
let array = DurationSecondArray::from(
vec![Some(i64::MIN), Some(i64::MAX), None, Some(4)],
);
let array: ArrayRef = Arc::new(array);
// Panics:
// arrow-array-55.1.0/src/temporal_conversions.rs:221:30:
// called `Option::unwrap()` on a `None` value
println!("The array is:\n{}", pretty_format_columns("array",
&[array]).unwrap());
}
```
<details><summary>Cargo.toml</summary>
<p>
```toml
[package]
name = "rust_playground2"
version = "0.1.0"
edition = "2024"
[dependencies]
arrow = { version ="55.1.0", features=["prettyprint"] }
````
Results in a panic
```
thread 'main' panicked at
/Users/andrewlamb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-array-55.1.0/src/temporal_conversions.rs:221:30:
called `Option::unwrap()` on a `None` value
```
<details><summary>Details</summary>
<p>
```
thread 'main' panicked at
/Users/andrewlamb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-array-55.1.0/src/temporal_conversions.rs:221:30:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: __rustc::rust_begin_unwind
at
/rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/std/src/panicking.rs:697:5
1: core::panicking::panic_fmt
at
/rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/panicking.rs:75:14
2: core::panicking::panic
at
/rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/panicking.rs:145:5
3: core::option::unwrap_failed
at
/rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/option.rs:2015:5
4: core::option::Option<T>::unwrap
at
/Users/andrewlamb/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:978:21
5: arrow_array::temporal_conversions::duration_s_to_duration
at
/Users/andrewlamb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-array-55.1.0/src/temporal_conversions.rs:221:5
6:
<&arrow_array::array::primitive_array::PrimitiveArray<arrow_array::types::DurationSecondType>
as arrow_cast::display::DisplayIndexState>::write
at
/Users/andrewlamb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-cast-55.1.0/src/display.rs:605:64
7: <arrow_cast::display::ArrayFormat<F> as
arrow_cast::display::DisplayIndex>::write
at
/Users/andrewlamb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-cast-55.1.0/src/display.rs:409:9
8: <arrow_cast::display::ValueFormatter as core::fmt::Display>::fmt
at
/Users/andrewlamb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-cast-55.1.0/src/display.rs:207:15
9: <T as alloc::string::SpecToString>::spec_to_string
at
/Users/andrewlamb/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/string.rs:2768:9
10: <T as alloc::string::ToString>::to_string
at
/Users/andrewlamb/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/string.rs:2747:9
11: comfy_table::cell::Cell::new
at
/Users/andrewlamb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/comfy-table-7.1.4/src/cell.rs:29:23
12: arrow_cast::pretty::create_column
at
/Users/andrewlamb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-cast-55.1.0/src/pretty.rs:203:30
13: arrow_cast::pretty::pretty_format_columns_with_options
at
/Users/andrewlamb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-cast-55.1.0/src/pretty.rs:126:5
14: arrow_cast::pretty::pretty_format_columns
at
/Users/andrewlamb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-cast-55.1.0/src/pretty.rs:115:5
15: rust_playground2::main
at ./src/main.rs:12:35
16: core::ops::function::FnOnce::call_once
at
/Users/andrewlamb/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose
backtrace.
```
</p>
</details>
</p>
</details>
**Expected behavior**
<!--
A clear and concise description of what you expected to happen.
-->
**Additional context**
<!--
Add any other context about the problem here.
-->
--
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]