2023-10-17 23:36:14 +08:00
|
|
|
[discrete]
|
2023-06-06 00:38:55 +08:00
|
|
|
[[esql-eval]]
|
|
|
|
=== `EVAL`
|
2023-11-06 15:42:13 +08:00
|
|
|
|
|
|
|
**Syntax**
|
|
|
|
|
|
|
|
[source,esql]
|
|
|
|
----
|
|
|
|
EVAL column1 = value1[, ..., columnN = valueN]
|
|
|
|
----
|
|
|
|
|
|
|
|
*Parameters*
|
|
|
|
|
|
|
|
`columnX`::
|
|
|
|
The column name.
|
|
|
|
|
|
|
|
`valueX`::
|
|
|
|
The value for the column. Can be a literal, an expression, or a
|
|
|
|
<<esql-functions,function>>.
|
|
|
|
|
|
|
|
*Description*
|
|
|
|
|
|
|
|
The `EVAL` processing command enables you to append new columns with calculated
|
|
|
|
values. `EVAL` supports various functions for calculating values. Refer to
|
|
|
|
<<esql-functions,Functions>> for more information.
|
|
|
|
|
|
|
|
*Examples*
|
2023-06-06 00:38:55 +08:00
|
|
|
|
2023-06-12 22:37:45 +08:00
|
|
|
[source.merge.styled,esql]
|
2023-06-06 00:38:55 +08:00
|
|
|
----
|
|
|
|
include::{esql-specs}/docs.csv-spec[tag=eval]
|
|
|
|
----
|
2023-06-12 22:37:45 +08:00
|
|
|
[%header.monospaced.styled,format=dsv,separator=|]
|
2023-06-06 00:38:55 +08:00
|
|
|
|===
|
|
|
|
include::{esql-specs}/docs.csv-spec[tag=eval-result]
|
|
|
|
|===
|
|
|
|
|
|
|
|
If the specified column already exists, the existing column will be dropped, and
|
|
|
|
the new column will be appended to the table:
|
|
|
|
|
2023-06-12 22:37:45 +08:00
|
|
|
[source.merge.styled,esql]
|
2023-06-06 00:38:55 +08:00
|
|
|
----
|
|
|
|
include::{esql-specs}/docs.csv-spec[tag=evalReplace]
|
|
|
|
----
|
2023-06-12 22:37:45 +08:00
|
|
|
[%header.monospaced.styled,format=dsv,separator=|]
|
2023-06-06 00:38:55 +08:00
|
|
|
|===
|
|
|
|
include::{esql-specs}/docs.csv-spec[tag=evalReplace-result]
|
|
|
|
|===
|