Jefffrey opened a new issue, #5336:
URL: https://github.com/apache/arrow-rs/issues/5336
**Describe the bug**
<!--
A clear and concise description of what the bug is.
-->
When debug printing a Time32/Time64 array with values outside of the
expected range (between 0 seconds (inclusive) and 86,400 seconds (exclusive),
adjusted based on milli/micro/nano), then it shows `null` for those values,
which can be confused with actual null values.
**To Reproduce**
<!--
Steps to reproduce the behavior:
-->
```rust
#[test]
fn test_pretty_format_time_32_second_invalid() {
let array: Time32SecondArray = vec![
Some(-1),
Some(0),
Some(86_399),
Some(86_400),
Some(86_401),
None,
]
.into();
println!("{:?}", array);
let schema = Arc::new(Schema::new(vec![Field::new(
"f",
array.data_type().clone(),
true,
)]));
let batch = RecordBatch::try_new(schema,
vec![Arc::new(array)]).unwrap();
let table = pretty_format_batches(&[batch]).unwrap().to_string();
println!("{}", table);
}
```
Outputs:
```
PrimitiveArray<Time32(Second)>
[
null,
00:00:00,
23:59:59,
null,
null,
null,
]
+---------------------------------------------------------------------------+
| f |
+---------------------------------------------------------------------------+
| ERROR: Cast error: Failed to convert -1 to temporal for Time32(Second) |
| 00:00:00 |
| 23:59:59 |
| ERROR: Cast error: Failed to convert 86400 to temporal for Time32(Second) |
| ERROR: Cast error: Failed to convert 86401 to temporal for Time32(Second) |
| |
+---------------------------------------------------------------------------+
```
**Expected behavior**
<!--
A clear and concise description of what you expected to happen.
-->
Either:
- Document this behaviour
- Print some other value for invalid values, like `<invalid>`, instead of
just `null`
**Additional context**
<!--
Add any other context about the problem here.
-->
Seems to be due to this code:
https://github.com/apache/arrow-rs/blob/8fff5e4a075c20619690c967e217163cd74e0656/arrow-array/src/array/primitive_array.rs#L1104-L1110
--
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]