Skip to content

[BUG] not ignore null in ARRAY_AGG with DISTINCT and IGNORE NULLS #19735

@davidlghellin

Description

@davidlghellin

Describe the bug

When using array_agg (or ARRAY_AGG) with both DISTINCT and IGNORE NULLS clauses, the IGNORE NULLS clause is not being respected. NULL values are included in the result even when they should be filtered out.

To Reproduce

SELECT ARRAY_AGG(DISTINCT x IGNORE NULLS) as result
FROM (VALUES (1), (2), (NULL), (2), (NULL), (1)) AS t(x);

Expected behavior

> SELECT ARRAY_AGG(DISTINCT x IGNORE NULLS) as result
FROM (VALUES (1), (2), (NULL), (2), (NULL), (1)) AS t(x);
+--------+
| result |
+--------+
| [2, 1]  |
+--------+

Additional context

DISTINCT and IGNORE NULLS

Image

IGNORE NULLS

Image

Testing ibis from Sail
lakehq/sail#1187

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions