Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support casting Date32 to timestamp #3504

Closed
comphead opened this issue Jan 10, 2023 · 2 comments · Fixed by #3508
Closed

Support casting Date32 to timestamp #3504

comphead opened this issue Jan 10, 2023 · 2 comments · Fixed by #3508
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog

Comments

@comphead
Copy link
Contributor

Describe the bug

Related to apache/datafusion#4644
Postgresql and datafusion support to cast date32 to timestamp, however its not yet covered by arrow-rs

To Reproduce

    #[test]
    fn test_cast_date32_to_timestamp() {
        let a = Date32Array::from(vec![10000, 17890]);
        let array = Arc::new(a) as ArrayRef;
        let b = cast(&array, &DataType::Timestamp(TimeUnit::Nanosecond, None)).unwrap();
        let c = b.as_any().downcast_ref::<TimestampNanosecondArray>().unwrap();
    }

thread 'cast::tests::test_cast_date32_to_timestamp' panicked at 'called `Result::unwrap()` on an `Err` value: CastError("Casting from Date32 to Timestamp(Nanosecond, None) not supported")', arrow-cast/src/cast.rs:7701:80

Expected behavior
Cast should work
Additional context

@comphead comphead added the bug label Jan 10, 2023
@comphead
Copy link
Contributor Author

Please assign this to me

@alamb alamb added enhancement Any new improvement worthy of a entry in the changelog arrow Changes to the arrow crate and removed bug labels Jan 11, 2023
@alamb alamb changed the title Unable to cast Date32 to timestamp Support casting Date32 to timestamp Jan 11, 2023
@alamb
Copy link
Contributor

alamb commented Jan 11, 2023

I changed this to to be a new feature rather than a bug (lol -- though I can see how a lack of functionality could be considered a bug)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants