Skip to content
New issue

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

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

Already on GitHub? # to your account

Allow casting durations to different timeunits #11097

Open
simonvandel opened this issue Jun 24, 2024 · 1 comment
Open

Allow casting durations to different timeunits #11097

simonvandel opened this issue Jun 24, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@simonvandel
Copy link
Contributor

Is your feature request related to a problem or challenge?

I would like to be able to cast a duration to a different timeunit.
Current behavior:

DataFusion CLI v39.0.0
> SELECT arrow_cast(1, 'Duration(Millisecond)');
+----------------------------------------------------+
| arrow_cast(Int64(1),Utf8("Duration(Millisecond)")) |
+----------------------------------------------------+
| 0 days 0 hours 0 mins 0.001 secs                   |
+----------------------------------------------------+
1 row(s) fetched. 
Elapsed 0.065 seconds.

> SELECT arrow_cast(arrow_cast(1, 'Duration(Millisecond)'), 'Duration(Second)');

This feature is not implemented: Unsupported CAST from Duration(Millisecond) to Duration(Second)

Describe the solution you'd like

The cast works

Describe alternatives you've considered

No response

Additional context

No response

@simonvandel simonvandel added the enhancement New feature or request label Jun 24, 2024
@alamb
Copy link
Contributor

alamb commented Jun 27, 2024

This makes sense -- the easist way would be to add support in the arrow cast kernels

Looks like only Int --> Duration is supported now

https://github.com/apache/arrow-rs/blob/0a4d8a14b58e45ef92e31541f0b51a5b25de5f10/arrow-cast/src/cast/mod.rs#L274-L275

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants