Skip to content

ESQL: Should MV_APPEND return null if any value is null? #121286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alex-spies opened this issue Jan 30, 2025 · 4 comments
Open

ESQL: Should MV_APPEND return null if any value is null? #121286

alex-spies opened this issue Jan 30, 2025 · 4 comments
Labels
:Analytics/ES|QL AKA ESQL >bug >docs General docs changes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Docs Meta label for docs team team-discuss

Comments

@alex-spies
Copy link
Contributor

alex-spies commented Jan 30, 2025

# curl -u elastic:password -H "Content-Type: application/json" "127.0.0.1:9200/_query?format=txt" -d '
{
  "query": "row x = [1,2], y = null | eval z = mv_append(x, y)"
}'

       x       |       y       |       z       
---------------+---------------+---------------
[1, 2]         |null           |null

This behavior is undocumented and I wonder if it's even useful. As a user, I expected MV_APPEND to return the left hand side multi-value rather than null, i.e. z = [1,2].

This is particularly tricky because we'd like to enhance MV_APPEND's behavior to take an arbitrary amount of arguments in #114436.
If I wanted to append multiple multivalues into a single one, simply skipping null values, there won't be a good way to achieve this. For just 2 arguments, one can work around this via CASE, but even that is not very ergonomic.

We should either make MV_APPEND an exception where one null value doesn't make us return null overall; or we should clearly document the behavior, including examples from our csv tests.

@elasticsearchmachine elasticsearchmachine added the needs:triage Requires assignment of a team area label label Jan 30, 2025
@alex-spies alex-spies added >bug >docs General docs changes :Analytics/ES|QL AKA ESQL and removed needs:triage Requires assignment of a team area label labels Jan 30, 2025
@elasticsearchmachine elasticsearchmachine added Team:Docs Meta label for docs team Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Jan 30, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@nik9000
Copy link
Member

nik9000 commented Jan 30, 2025

I'd be ok making MV_APPEND treat null like an empty list of values. It is that at a lot of places in Elaticsearch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >bug >docs General docs changes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Docs Meta label for docs team team-discuss
Projects
None yet
Development

No branches or pull requests

4 participants