Skip to content

Regression on coercing Array of Structs #12843

@kazuyukitanimura

Description

@kazuyukitanimura

Describe the bug

https://github.com/apache/datafusion/pull/12753/files#diff-f1e354d4fe26237064d8194e10a6008efa4f88e2b68b8a8352086a5d011180b8R108 introduced to use type_union_resolution; however, this caused a regression on coerce_types against Array of Structs.

type_union_resolution returns None for such cases and let the plan fail.

To Reproduce

Found at apache/datafusion-comet#1001 (comment)

Expected behavior

The fix seems to be easy. We just need to addd

                .or_else(|| struct_coercion(lhs_type, rhs_type))

at the end of type_union_resolution_coercion

Then, type_union_resolution returns Some(...) for Array of Structs.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions