It seems to me the panic on printing out the array is a bug.

I think the code should have either errored out in the builder
(date_32_builder.append_value()) or passed successfully.

It wasn't immediately clear to me from the arrow format definition[1]
envisions signed integers, but the rust code uses i32 signed integers [2].

[1] https://github.com/apache/arrow/blob/master/format/Schema.fbs
[2]
https://github.com/apache/arrow/blob/d4a521aca48340a58c787b6067e11590fde1c05f/rust/arrow/src/datatypes/types.rs#L71

On Tue, Mar 2, 2021 at 11:47 AM Eric Burden <eric.w.bur...@gmail.com> wrote:

> As it says on the subject line. I encountered this issue attempting to
> store dates prior to the epoch (1970-01-01). I checked for an issue in JIRA
> and GitHub, but I didn't see anything related and wanted to raise it as a
> discussion before I filed an issue.
>
> MRE:
>
> fn test_date32_builder() {
>     let mut date_32_builder = Date32Builder::new(1);
>     date_32_builder.append_value(-50).unwrap();
>     let date_32_array = date_32_builder.finish();
>     println!("{:?}", date_32_array);  // panics}
>
> *Result:*
> PrimitiveArray<Date32>
> [
> thread 'demo::tests::test_date32_builder' panicked at 'called
> `Option::unwrap()` on a `None` value',
>
> /home/eric/.cargo/git/checkouts/arrow-3a9cfebb6b7b2bdc/f7cf157/rust/arrow/src/array/array_primitive.rs:226
> :54
> note: run with `RUST_BACKTRACE=1` environment variable to display a
> backtrace
>

Reply via email to