Skip to content

array_remove_* returns wrong response for NULLs #21011

Closed

Description

@comphead

Describe the bug

originated from apache/datafusion-comet#3173

> SELECT array_remove_all(make_array(1, null, 2, null, 3), null);
+-------------------------------------------------------------------------+
| array_remove_all(make_array(Int64(1),NULL,Int64(2),NULL,Int64(3)),NULL) |
+-------------------------------------------------------------------------+
| [1, 2, 3]                                                               |
+-------------------------------------------------------------------------+
1 row(s) fetched. 
Elapsed 0.026 seconds.

> SELECT array_remove(make_array(1, null, 2, null, 3), null);
+---------------------------------------------------------------------+
| array_remove(make_array(Int64(1),NULL,Int64(2),NULL,Int64(3)),NULL) |
+---------------------------------------------------------------------+
| [1, 2, NULL, 3]                                                     |
+---------------------------------------------------------------------+

However Trino or Spark in this case return just NULL

To Reproduce

No response

Expected behavior

No response

Additional context

No response

Activity

  1. added theissue type on Mar 17, 2026
  2. buraksenn commented on Mar 17, 2026

    @buraksenn
    Contributor

    take

  3. buraksenn commented on Mar 17, 2026

    @buraksenn
    Contributor

    Expectation here is to return same responses as Trino and Spark right @comphead? if that is the case I can open a PR for this early tomorrow

  4. comphead commented on Mar 17, 2026

    @comphead
    ContributorAuthor

    Thanks @buraksenn I think I already have a PR ready, I'd like to get it faster to #19692

    Appreciate if you can review though

  5. buraksenn commented on Mar 17, 2026

    @buraksenn
    Contributor

    Thanks @buraksenn I think I already have a PR ready, I'd like to get it faster to #19692

    Appreciate if you can review though

    I understand, just checked the PR. As per the implementation, appending null if the element is null should work. Nice quick work @comphead thanks for the heads up

  6. added a commit that references this issue on Mar 17, 2026
    6ab16cc
  7. added 2 commits that reference this issue on Mar 17, 2026
    b8cf4b6
    5746048
  8. added a commit that references this issue on Mar 24, 2026
    566611e
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

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions