Skip to content

Support casting BinaryView --> Utf8 and LargeUtf8 #6162

@alamb

Description

@alamb

Part of #6163

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
While working to enable StringView use more widely in DataFusion in apache/datafusion#11723 I found this cast function was not supported:

Specifically, create a BinaryViewArray and then call cast to cast it to Utf8:

cast(binary_view_array, &DataType::Utf8)
External error: query failed: DataFusion error: Error during planning: Cannot cast file schema field string_col of type BinaryView to table schema field of type Utf8

I think this came about if a column is marked as "binary" in a parqut file and DataFusion tries to read it in as a Utf8 column the reader will be unbappy

Describe the solution you'd like
Add the support to the cast kernel for BinaryView -> utf8

@RinChanNOWWW added most support in #5704 and I think we can simply use the cast_view_to_byte function to build the correct StringArray

Describe alternatives you've considered

Additional context
FYI @XiangpengHao

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrowChanges to the arrow crateenhancementAny new improvement worthy of a entry in the changelog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions