Skip to content

Commit 8f30723

Browse files
authored
Merge branch 'main' into search_load_per_index_multiproject
2 parents b439f89 + 045c233 commit 8f30723

File tree

9 files changed

+810
-721
lines changed

9 files changed

+810
-721
lines changed

docs/reference/query-languages/esql/_snippets/commands/layout/rename.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ The `RENAME` processing command renames one or more columns.
88
RENAME old_name1 AS new_name1[, ..., old_nameN AS new_nameN]
99
```
1010

11+
The following syntax is also supported {applies_to}`stack: ga 9.1`:
12+
13+
```esql
14+
RENAME new_name1 = old_name1[, ..., new_nameN = old_nameN]
15+
```
16+
17+
::::{tip}
18+
Both syntax options can be used interchangeably but we recommend sticking to one for consistency and readability.
19+
::::
20+
1121
**Parameters**
1222

1323
`old_nameX`

docs/reference/query-languages/esql/_snippets/lists/processing-commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* [`CHANGE_POINT`](../../commands/processing-commands.md#esql-change_point)
1+
* [preview] [`CHANGE_POINT`](../../commands/processing-commands.md#esql-change_point)
22
* [`DISSECT`](../../commands/processing-commands.md#esql-dissect)
33
* [`DROP`](../../commands/processing-commands.md#esql-drop)
44
* [`ENRICH`](../../commands/processing-commands.md#esql-enrich)

muted-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,9 @@ tests:
517517
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeForkIT
518518
method: test {lookup-join.EnrichLookupStatsBug SYNC}
519519
issue: https://github.com/elastic/elasticsearch/issues/129229
520+
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeForkIT
521+
method: test {lookup-join.MultipleBatches*
522+
issue: https://github.com/elastic/elasticsearch/issues/129210
520523

521524
# Examples:
522525
#

x-pack/plugin/esql/qa/testFixtures/src/main/resources/rename.csv-spec

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,50 @@ ROW a="keyword", b=5, c=null
296296
a:integer
297297
5
298298
;
299+
300+
useAssignmentOnly
301+
required_capability: rename_allow_assignment
302+
303+
ROW a = 1, b = "two"
304+
| RENAME aa = a, bb = b
305+
;
306+
307+
aa:integer | bb:keyword
308+
1 | two
309+
;
310+
311+
useAssignmentAndASKeyword
312+
required_capability: rename_allow_assignment
313+
314+
ROW a = 1, b = "two", c = null
315+
| RENAME aa = a, b AS bb, cc = c
316+
;
317+
318+
aa:integer | bb:keyword | cc:null
319+
1 | two | null
320+
;
321+
322+
shadowWithAssignment
323+
required_capability: rename_allow_assignment
324+
325+
ROW a = 1, b = "two"
326+
| RENAME a = b
327+
;
328+
329+
a:keyword
330+
two
331+
;
332+
333+
multipleRenamesWithAssignment
334+
required_capability: rename_sequential_processing
335+
required_capability: rename_allow_assignment
336+
337+
ROW a="keyword", b=5, c=null
338+
| RENAME c = a, a = b
339+
| RENAME b = c
340+
| RENAME b = a, a = b
341+
;
342+
343+
a:integer
344+
5
345+
;

x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ renameCommand
212212

213213
renameClause:
214214
oldName=qualifiedNamePattern AS newName=qualifiedNamePattern
215+
| newName=qualifiedNamePattern ASSIGN oldName=qualifiedNamePattern
215216
;
216217

217218
dissectCommand

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,11 @@ public enum Cap {
439439
*/
440440
RENAME_SEQUENTIAL_PROCESSING,
441441

442+
/**
443+
* Support for assignment in RENAME, besides the use of `AS` keyword.
444+
*/
445+
RENAME_ALLOW_ASSIGNMENT,
446+
442447
/**
443448
* Support for removing empty attribute in merging output.
444449
* See <a href="https://github.com/elastic/elasticsearch/issues/126392"> ESQL: EVAL after STATS produces an empty column #126392 </a>

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.interp

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)