Skip to content

[Variant] cast_to_variant conflates empty map with NULL #8289

@scovich

Description

@scovich

Describe the bug

While trying to refactor cast_to_variant to be more efficient, I noticed that the logic for maps does not check for NULL entries. It only looks at the offsets, which technically only say how many entries the map has.

To Reproduce

test_cast_map_to_variant_object_with_nulls produces a MapArray with no NULL rows, and the test expects a NULL output for the row that had an empty map.

Expected behavior

The test should produce a MapArray where one row is an empty map and another row is NULL; the former should become a variant object with no fields and the other should become NULL or Variant::Null (depending on whether the map is top-level or nested inside another variant value).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions