eval.asciidoc 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. [discrete]
  2. [[esql-eval]]
  3. === `EVAL`
  4. **Syntax**
  5. [source,esql]
  6. ----
  7. EVAL column1 = value1[, ..., columnN = valueN]
  8. ----
  9. *Parameters*
  10. `columnX`::
  11. The column name.
  12. `valueX`::
  13. The value for the column. Can be a literal, an expression, or a
  14. <<esql-functions,function>>.
  15. *Description*
  16. The `EVAL` processing command enables you to append new columns with calculated
  17. values. `EVAL` supports various functions for calculating values. Refer to
  18. <<esql-functions,Functions>> for more information.
  19. *Examples*
  20. [source.merge.styled,esql]
  21. ----
  22. include::{esql-specs}/docs.csv-spec[tag=eval]
  23. ----
  24. [%header.monospaced.styled,format=dsv,separator=|]
  25. |===
  26. include::{esql-specs}/docs.csv-spec[tag=eval-result]
  27. |===
  28. If the specified column already exists, the existing column will be dropped, and
  29. the new column will be appended to the table:
  30. [source.merge.styled,esql]
  31. ----
  32. include::{esql-specs}/docs.csv-spec[tag=evalReplace]
  33. ----
  34. [%header.monospaced.styled,format=dsv,separator=|]
  35. |===
  36. include::{esql-specs}/docs.csv-spec[tag=evalReplace-result]
  37. |===