elasticsearch icon indicating copy to clipboard operation
elasticsearch copied to clipboard

ES|QL: add MV_APPEND function

Open luigidellaquila opened this issue 10 months ago • 5 comments

Adding MV_APPEND(value1, value2) function, that appends two values creating a single multi-value. If one or both the inputs are multi-values, the result is the concatenation of all the values, eg.

MV_APPEND([a, b], [c, d]) -> [a, b, c, d]

~I think for this specific case it makes sense to consider null values as empty arrays, so that~

MV_APPEND(value, null) -> value

~It is pretty uncommon for ESQL (all the other functions, apart from COALESCE, short-circuit to null when one of the values is null), so let's discuss this behavior.~

[EDIT] considering the feedback from Andrei, I changed this logic and made it consistent with the other functions: now if one of the parameters is null, the function returns null

luigidellaquila avatar Apr 02 '24 13:04 luigidellaquila

Documentation preview:

github-actions[bot] avatar Apr 02 '24 13:04 github-actions[bot]

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

elasticsearchmachine avatar Apr 02 '24 13:04 elasticsearchmachine

@elasticmachine update branch

luigidellaquila avatar Apr 02 '24 13:04 luigidellaquila

I think for this specific case it makes sense to consider null values as empty arrays, so that

That's fine - our null is basically an empty list. I'd do it.

nik9000 avatar Apr 02 '24 14:04 nik9000

It is pretty uncommon for ESQL (all the other functions, apart from COALESCE, short-circuit to null when one of the values is null), so let's discuss this behavior.

There's a small number that don't - maybe 5 out of the 100.

nik9000 avatar Apr 02 '24 14:04 nik9000

@elasticmachine update branch

luigidellaquila avatar Jun 04 '24 13:06 luigidellaquila

@elasticmachine update branch

luigidellaquila avatar Jun 04 '24 16:06 luigidellaquila