Skip to content

Support Utf8View for string function bit_length #13195

@jayzhan211

Description

@jayzhan211

Is your feature request related to a problem or challenge?

Bit length for example doesn't support utf8view yet.

query error
select bit_length(arrow_cast('a', 'Utf8View'));
----
DataFusion error: Optimizer rule 'optimize_projections' failed
caused by
optimize_projections
caused by
Internal error: Failed due to a difference in schemas, original schema: DFSchema { inner: Schema { fields: [Field { name: "bit_length(arrow_cast(Utf8(\"a\"),Utf8(\"Utf8View\")))", data_type: Int32, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {} }, field_qualifiers: [None], functional_dependencies: FunctionalDependencies { deps: [] } }, new schema: DFSchema { inner: Schema { fields: [Field { name: "bit_length(arrow_cast(Utf8(\"a\"),Utf8(\"Utf8View\")))", data_type: Int64, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {} }, field_qualifiers: [None], functional_dependencies: FunctionalDependencies { deps: [] } }.
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker


statement ok
create table test_source as values
  ('Andrew', 'X'),
  ('Xiangpeng', 'Xiangpeng'),
  ('Raphael', 'R'),
  (NULL, 'R');

# Table with the different combination of column types
statement ok
create table test as
SELECT
  arrow_cast(column1, 'Utf8View') as column1_utf8view
FROM test_source;

query error DataFusion error: Arrow error: Compute error: bit_length not supported for Utf8View
select bit_length(column1_utf8view) from test;

Describe the solution you'd like

I hope we can support utf8view for all the string functions

Describe alternatives you've considered

No response

Additional context

No response

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