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

Cast between array elements #6558

Closed
izveigor opened this issue Jun 6, 2023 · 3 comments · Fixed by #6607
Closed

Cast between array elements #6558

izveigor opened this issue Jun 6, 2023 · 3 comments · Fixed by #6607
Labels
enhancement New feature or request

Comments

@izveigor
Copy link
Contributor

izveigor commented Jun 6, 2023

Is your feature request related to a problem or challenge?

Arter Pull Request: #6384, In arrow-datafusion casting between arrays elements stopped working. The feature could be of great help when working with different types of data.

Describe the solution you'd like

All rules should be simillar to the cast function in arrow-rs (See https://docs.rs/arrow/latest/arrow/compute/kernels/cast/index.html)

For example, if we create new array with Int32Type and Int64Type should return Int64Array.

select make_array(Int32(1), Int64(2));
----
Int64(1), Int64(2)

Describe alternatives you've considered

No response

Additional context

Simillar Issues:
#6119
#6075

Simillar PR:
#6384

@jayzhan211
Copy link
Contributor

jayzhan211 commented Jun 8, 2023

How to determine the final data type? For example, make_array(int, uint, float), what should be the result data type?

@izveigor
Copy link
Contributor Author

izveigor commented Jun 8, 2023

@jayzhan211 arrow-datafusion has rules for data type coercion (See https://github.com/apache/arrow-datafusion/blob/main/datafusion/expr/src/type_coercion/binary.rs)
For your instance, the result should be float data type (because Int -> UInt and UInt -> Float)

@jayzhan211
Copy link
Contributor

I will take this

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants