elasticsearch/docs/reference/esql/source-commands/row.asciidoc
Alexander Spies da5392134f
ESQL: Validate unique plan attribute names (#110488)
* Enforce an invariant in our dependency checker so that logical plans never have duplicate output attribute names or ids.
* Fix ROW to not produce columns with duplicate names.
* Fix ResolveUnionTypes to not create multiple synthetic field attributes for the same union type.
* Add tests for commands using the same column name more than once.
* Update docs w.r.t. how commands behave if they are used with duplicate column names.
2024-07-17 11:39:02 +02:00

48 lines
949 B
Text

[discrete]
[[esql-row]]
=== `ROW`
The `ROW` source command produces a row with one or more columns with values
that you specify. This can be useful for testing.
**Syntax**
[source,esql]
----
ROW column1 = value1[, ..., columnN = valueN]
----
*Parameters*
`columnX`::
The column name.
In case of duplicate column names, only the rightmost duplicate creates a column.
`valueX`::
The value for the column. Can be a literal, an expression, or a
<<esql-functions,function>>.
*Examples*
[source.merge.styled,esql]
----
include::{esql-specs}/row.csv-spec[tag=example]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/row.csv-spec[tag=example-result]
|===
Use square brackets to create multi-value columns:
[source,esql]
----
include::{esql-specs}/row.csv-spec[tag=multivalue]
----
`ROW` supports the use of <<esql-functions,functions>>:
[source,esql]
----
include::{esql-specs}/row.csv-spec[tag=function]
----