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 nested list casting #4483

Open
jayzhan211 opened this issue Jul 8, 2023 · 0 comments
Open

Support nested list casting #4483

jayzhan211 opened this issue Jul 8, 2023 · 0 comments
Labels
enhancement Any new improvement worthy of a entry in the changelog

Comments

@jayzhan211
Copy link
Contributor

jayzhan211 commented Jul 8, 2023

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

Currently, the implementation of typecasting in the ListArray assumes that the inner elements have the same dimension as the targeted ListArray. However, there is a need to support nested list casting, where the internal elements can have a different dimension than the targeted ListArray.

For example,
Array: ListArray[PrimitiveArray[1,2,3]]
Targeted Type: List(List(Int32))
Current result: ListArray[ListArray[PrimitiveArray[1], PrimitiveArray[2], PrimitiveArray[3]]]
Expected result: ListArray[ListArray[PrimitiveArray[1,2,3]]

Describe the solution you'd like

Casting List to the same dimensions first, then cast the inner primitive type. Only casting from lower dimension to high dimension is allowed.

Additional: Adding fn get_list_dimension for DataType::List is also helpful.

Describe alternatives you've considered

Additional context

This feature is helpful for apache/datafusion#6849

Self-assigned

@jayzhan211 jayzhan211 added the enhancement Any new improvement worthy of a entry in the changelog label Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant