Skip to content

handle Null type in try_merge for Struct, List, LargeList, and Union #9523

@zhuqi-lucas

Description

@zhuqi-lucas

Describe the bug
Field::try_merge correctly handles DataType::Null for primitive types
and when self is Null, but fails when self is a compound type (Struct,
List, LargeList, Union) and from is Null. This causes Schema::try_merge
to error when merging schemas where one has a Null field and another has a
concrete compound type for the same field.

This is common in JSON inference where some files have null values for
fields that are structs/lists in other files.

To Reproduce

Expected behavior
Add DataType::Null arms to the Struct, List, LargeList, and Union
branches in Field::try_merge, consistent with how primitive types
already handle it.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrowChanges to the arrow cratebug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions