Skip to content

array functions don't work with FixedSizeList #8084

Closed as duplicate
Closed as duplicate

Description

@universalmind303

Describe the bug

none of the scalar array_ functions work on FixedSizeList dtype.

To Reproduce

given a table of

+-----------------+--------+
| fixed_size_list | list   |
+-----------------+--------+
| [0, 1]          | [0, 1] |
| [0, 2]          | [0, 2] |
+-----------------+--------+

I should be able to use array_* functions on both list and fixed_size_list fields

SELECT array_length(list) FROM my_table

+-----------------------------+
| array_length(my_table.list) |
+-----------------------------+
| 2                           |
| 2                           |
+-----------------------------+

Full reproducible example here: https://gist.github.com/universalmind303/e2e59cd6d84656f5f20e78bd6e9c6c74

Expected behavior

SELECT array_length(fixed_size_list) FROM my_table

+----------------------------------------+
| array_length(my_table.fixed_size_list) |
+----------------------------------------+
| 2                                      |
| 2                                      |
+----------------------------------------+

Additional context

I don't think all of them should work. Such as ones that mutate the array (repeat, remove, ...). But I'd expect many of the immutable functions to work such as has, length, element, and so on.

Activity

  1. alamb commented on Nov 7, 2023

    @alamb
    Contributor

    The same thing probably goes for LargeList as well (it isn't supported)

  2. Weijun-H commented on Nov 8, 2023

    @Weijun-H
    Member

    The same thing probably goes for LargeList as well (it isn't supported)

    Yes, I believe the array function now only accepts List. I am happy to take this ticket.

  3. alamb commented on Nov 8, 2023

    @alamb
    Contributor

    Yes, I believe the array function now only accepts List. I am happy to take this ticket.

    Thanks @Weijun-H

    In order to make this project tractable, I suggest picking one array function (ideally a simple one) and figuring out a good pattern for:

    1. Testing
    2. Implementing

    In particular, I think this may require writing some generic code (over OffsetSize) trait

  4. jayzhan211 commented on Nov 8, 2023

    @jayzhan211
    Contributor

    For LargeList, you can take #7897 for reference

  5. self-assigned this
    on Sep 19, 2025
  6. Jefffrey commented on Sep 19, 2025

    @Jefffrey
    Contributor

    I plan to go through the array functions in datafusion-functions-nested and check this support as well as tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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