ericwburden opened a new pull request #9624: URL: https://github.com/apache/arrow/pull/9624
Corrects an issue with the Debug implementation for ArrowNativeTypes (like Date32Array) that panic for negative values due to a .to_usize() call. This may impact the handling of Time32/Time64 since as_time() contains an explicit cast to u32. This was accomplished by adding `.to_isize()` to the `ArrowNativeType` trait and implementing it for all types that implement `ArrowNativeType`. This also meant removing the `.to_isize()` function from the `OffsetSizeTrait` trait since it was redudant. Since code that relied on `OffsetSizeTrait::to_isize()` were expecting an `isize` and not `Option<isize>`, I added `unwrap()` calls. This is potentially not the right approach, normally I'd want to properly handle any `Err` that resulted, but the code was already relying on `unwrap()` and I wanted to keep my scope narrow. The result of this change is that negative values are allowed (and printable through `Debug`) for Date32, Date64, Timestamp32, and Timestamp64 typed Arrays. Time32/Time64 still accept negative values when building and panic on printing, but now the error comes from chrono not converting negative values to 'time' format. If negative values are not valid for Time32/Time64 Arrays, it may be necessary to add some checking/error handling to the `.append_*()` functions to prevent adding negative values in the first place. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org