Skip to content

[Bug] array_agg_foreach funtion is broken #52252

@IsmailTosunTnyl

Description

@IsmailTosunTnyl

Search before asking

  • I had searched in the issues and found no similar issues.

Version

tested on 2.1.6, 2.1.7, 3.0.6, master

What's Wrong?

array_agg_foreach(a) function produce different result on every call, all of them wrong

What You Expected?

function should work like in documentation
https://doris.apache.org/docs/sql-manual/sql-functions/combinators/foreach?_highlight=foreach

How to Reproduce?

-- create table 
CREATE TABLE IF NOT EXISTS db (
    id INT NOT NULL COMMENT "unique id", -- Benzersiz bir ID sütunu eklemek iyi bir pratik
    a ARRAY<INT> NULL COMMENT "Integer array column",
    s ARRAY<STRING> NULL COMMENT "String array column"
)
DUPLICATE KEY(id)
DISTRIBUTED BY HASH(id) BUCKETS 10
PROPERTIES (
    "replication_allocation" = "tag.location.default:1"
);

-- insert data 
INSERT INTO db (id, a, s) VALUES
(1, [1, 2, 3], ["ab", "123"]),
(2, [20], ["cd"]),
(3, [100], ["efg"]),
(4, NULL, NULL),
(5, [null, 2], [null, "c"]);

-- call function a few times, every run will return a different combination 
SELECT array_agg_foreach(a) FROM db;

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions