mv_median.asciidoc 915 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. [discrete]
  2. [[esql-mv_median]]
  3. === `MV_MEDIAN`
  4. [source,esql]
  5. ----
  6. MV_MEDIAN(v)
  7. ----
  8. *Parameters*
  9. `v`::
  10. Multivalue expression.
  11. *Description*
  12. Converts a multivalued column into a single valued column containing the median
  13. value.
  14. *Supported types*
  15. include::types/mv_median.asciidoc[]
  16. *Examples*
  17. [source.merge.styled,esql]
  18. ----
  19. include::{esql-specs}/math.csv-spec[tag=mv_median]
  20. ----
  21. [%header.monospaced.styled,format=dsv,separator=|]
  22. |===
  23. include::{esql-specs}/math.csv-spec[tag=mv_median-result]
  24. |===
  25. If the row has an even number of values for a column, the result will be the
  26. average of the middle two entries. If the column is not floating point, the
  27. average rounds *down*:
  28. [source.merge.styled,esql]
  29. ----
  30. include::{esql-specs}/math.csv-spec[tag=mv_median_round_down]
  31. ----
  32. [%header.monospaced.styled,format=dsv,separator=|]
  33. |===
  34. include::{esql-specs}/math.csv-spec[tag=mv_median_round_down-result]
  35. |===