39 lines
992 B
Plaintext
39 lines
992 B
Plaintext
[discrete]
|
|
[[esql-mv_last]]
|
|
=== `MV_LAST`
|
|
|
|
*Syntax*
|
|
|
|
[.text-center]
|
|
image::esql/functions/signature/mv_last.svg[Embedded,opts=inline]
|
|
|
|
*Parameters*
|
|
|
|
`v`::
|
|
Multivalue expression.
|
|
|
|
*Description*
|
|
|
|
Converts a multivalue expression into a single valued column containing the last
|
|
value. This is most useful when reading from a function that emits multivalued
|
|
columns in a known order like <<esql-split>>.
|
|
|
|
The order that <<esql-multivalued-fields, multivalued fields>> are read from
|
|
underlying storage is not guaranteed. It is *frequently* ascending, but don't
|
|
rely on that. If you need the maximum value use <<esql-mv_max>> instead of
|
|
`MV_LAST`. `MV_MAX` has optimizations for sorted values so there isn't a
|
|
performance benefit to `MV_LAST`.
|
|
|
|
include::types/mv_last.asciidoc[]
|
|
|
|
*Example*
|
|
|
|
[source.merge.styled,esql]
|
|
----
|
|
include::{esql-specs}/string.csv-spec[tag=mv_last]
|
|
----
|
|
[%header.monospaced.styled,format=dsv,separator=|]
|
|
|===
|
|
include::{esql-specs}/string.csv-spec[tag=mv_last-result]
|
|
|===
|