Skip to content

[arrow-cast] incorrect Time32 -> Time64 conversion #9851

Description

@bboissin

Describe the bug

Converting from Time32(Milli) to Time64(Nano) zeroes out values instead of converting.

To Reproduce

    #[test]
    fn test_cast_time32_millisecond_to_time64_nanosecond() {
        let array =
            Time32MillisecondArray::from(vec![Some(1_000), Some(2_000), None, Some(43_200_000)]);
        let b = cast(&array, &DataType::Time64(TimeUnit::Nanosecond)).unwrap();
        let c = b.as_primitive::<Time64NanosecondType>();
        assert_eq!(c.value(0), 1_000_000_000);
        assert_eq!(c.value(1), 2_000_000_000);
        assert!(c.is_null(2));
        assert_eq!(c.value(3), 43_200_000_000_000);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrowChanges to the arrow cratebug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions