Skip to content

Cast between array elements #6558

Closed

Description

@izveigor

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

Activity

  1. jayzhan211 commented on Jun 8, 2023

    @jayzhan211
    Contributor

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

  2. izveigor commented on Jun 8, 2023

    @izveigor
    ContributorAuthor

    @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)

  3. jayzhan211 commented on Jun 9, 2023

    @jayzhan211
    Contributor

    I will take this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions